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

CHECK report for BufferedMatrix on tokay2

This page was generated on 2020-10-17 11:56:11 -0400 (Sat, 17 Oct 2020).

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 210/1905HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.52.0
Ben Bolstad
Snapshot Date: 2020-10-16 14:40:19 -0400 (Fri, 16 Oct 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_11
Last Commit: c4ad43d
Last Changed Date: 2020-04-27 14:14:34 -0400 (Mon, 27 Apr 2020)
malbec2 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository
machv2 macOS 10.14.6 Mojave / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.52.0
Command: C:\Users\biocbuild\bbs-3.11-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.11-bioc\R\library --no-vignettes --timings BufferedMatrix_1.52.0.tar.gz
StartedAt: 2020-10-17 02:08:25 -0400 (Sat, 17 Oct 2020)
EndedAt: 2020-10-17 02:09:33 -0400 (Sat, 17 Oct 2020)
EllapsedTime: 68.2 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory 'C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.0.3 (2020-10-10)
* 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.52.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.11-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.11-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.11-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\cygwin\bin\curl.exe -O https://malbec2.bioconductor.org/BBS/3.11/bioc/src/contrib/BufferedMatrix_1.52.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.11-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.52.0.tar.gz && C:\Users\biocbuild\bbs-3.11-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.52.0.zip && rm BufferedMatrix_1.52.0.tar.gz BufferedMatrix_1.52.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  201k  100  201k    0     0  3153k      0 --:--:-- --:--:-- --:--:-- 3532k

install for i386

* installing *source* package 'BufferedMatrix' ...
** using staged installation
** libs
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.11-/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.11-/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.11-/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.11-/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.11-/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.11-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.11-/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.11-/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.11-/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.11-/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.11-/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.52.0.zip
* DONE (BufferedMatrix)
* installing to library 'C:/Users/biocbuild/bbs-3.11-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.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.62    0.09    0.70 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.56    0.06    0.65 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.11-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 434274 13.3     919958 28.1   641648 19.6
Vcells 496903  3.8    8388608 64.0  1483959 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] "Sat Oct 17 02:08:59 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Oct 17 02:08:59 2020"
> 
> 
> 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: 0x02efd7c8>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Oct 17 02:09:02 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Oct 17 02:09:02 2020"
> 
> ColMode(tmp2)
<pointer: 0x02efd7c8>
> 
> 
> 
> ### 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.6447961  1.95879714  0.18265984 -0.25268147
[2,]   1.2975625 -1.04668999 -0.35780831 -1.15469270
[3,]  -0.9034898  0.73057103  0.22700333  1.07091205
[4,]  -0.1094870 -0.03523919  0.09218426 -0.07521701
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.11-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.6447961 1.95879714 0.18265984 0.25268147
[2,]   1.2975625 1.04668999 0.35780831 1.15469270
[3,]   0.9034898 0.73057103 0.22700333 1.07091205
[4,]   0.1094870 0.03523919 0.09218426 0.07521701
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.11-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.0321880 1.3995703 0.4273872 0.5026743
[2,]  1.1391060 1.0230787 0.5981708 1.0745663
[3,]  0.9505208 0.8547345 0.4764487 1.0348488
[4,]  0.3308882 0.1877210 0.3036186 0.2742572
> 
> 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.11-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.96668 40.95450 29.45653 30.27942
[2,]  37.68862 36.27748 31.33952 36.90036
[3,]  35.40870 34.27792 29.99149 36.41940
[4,]  28.41837 26.91245 28.12837 27.81779
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x086e9348>
> exp(tmp5)
<pointer: 0x086e9348>
> log(tmp5,2)
<pointer: 0x086e9348>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.32
> Min(tmp5)
[1] 52.70437
> mean(tmp5)
[1] 72.69258
> Sum(tmp5)
[1] 14538.52
> Var(tmp5)
[1] 864.3464
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.50575 70.50794 71.73327 67.39603 69.90021 69.63664 68.06741 72.81795
 [9] 70.55465 72.80592
> rowSums(tmp5)
 [1] 1870.115 1410.159 1434.665 1347.921 1398.004 1392.733 1361.348 1456.359
 [9] 1411.093 1456.118
> rowVars(tmp5)
 [1] 7944.18115   66.93345   50.58375   58.87990   31.26906   50.11680
 [7]   49.18117  125.95344   57.41047   81.47407
> rowSd(tmp5)
 [1] 89.130136  8.181287  7.112226  7.673324  5.591875  7.079322  7.012929
 [8] 11.222898  7.576969  9.026299
> rowMax(tmp5)
 [1] 470.32003  84.18055  86.05745  84.43360  80.28032  80.95279  82.32292
 [8]  93.88027  80.84069  88.98916
> rowMin(tmp5)
 [1] 59.31335 57.51980 60.57477 56.01474 58.34072 55.12845 56.10838 52.70437
 [9] 56.74619 59.71881
> 
> colMeans(tmp5)
 [1] 111.42577  70.45058  66.57443  70.38226  70.57143  66.09395  68.21517
 [8]  70.39372  73.88138  73.57133  69.99818  72.75785  71.62893  69.76525
[15]  70.46371  69.00484  70.94366  71.58931  72.44852  73.69129
> colSums(tmp5)
 [1] 1114.2577  704.5058  665.7443  703.8226  705.7143  660.9395  682.1517
 [8]  703.9372  738.8138  735.7133  699.9818  727.5785  716.2893  697.6525
[15]  704.6371  690.0484  709.4366  715.8931  724.4852  736.9129
> colVars(tmp5)
 [1] 15965.15546    75.30223    27.42887   107.68356    87.27553    36.30959
 [7]    62.54787   102.55778   108.14945    82.21772    36.74443    68.80194
[13]   113.91474    41.92385    56.96890    31.07094    71.88132    71.69790
[19]    38.74798    75.85699
> colSd(tmp5)
 [1] 126.353296   8.677686   5.237257  10.377069   9.342137   6.025744
 [7]   7.908721  10.127082  10.399493   9.067399   6.061718   8.294694
[13]  10.673085   6.474863   7.547774   5.574131   8.478285   8.467461
[19]   6.224788   8.709592
> colMax(tmp5)
 [1] 470.32003  85.24143  76.01744  84.87653  88.98916  74.41693  78.01135
 [8]  88.55411  93.88027  84.43360  77.26708  90.25615  93.19416  79.14231
[15]  83.92175  76.98835  84.18055  82.02133  83.96843  84.91939
> colMin(tmp5)
 [1] 59.14911 56.01474 58.54552 56.74619 58.34072 57.13231 52.70437 56.17484
 [9] 60.35930 60.57136 62.12929 62.72882 55.12845 59.31335 60.10756 60.57477
[17] 61.35918 56.10838 65.15793 57.51980
> 
> 
> ### 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] 93.50575 70.50794 71.73327 67.39603 69.90021 69.63664 68.06741 72.81795
 [9]       NA 72.80592
> rowSums(tmp5)
 [1] 1870.115 1410.159 1434.665 1347.921 1398.004 1392.733 1361.348 1456.359
 [9]       NA 1456.118
> rowVars(tmp5)
 [1] 7944.18115   66.93345   50.58375   58.87990   31.26906   50.11680
 [7]   49.18117  125.95344   59.36713   81.47407
> rowSd(tmp5)
 [1] 89.130136  8.181287  7.112226  7.673324  5.591875  7.079322  7.012929
 [8] 11.222898  7.705007  9.026299
> rowMax(tmp5)
 [1] 470.32003  84.18055  86.05745  84.43360  80.28032  80.95279  82.32292
 [8]  93.88027        NA  88.98916
> rowMin(tmp5)
 [1] 59.31335 57.51980 60.57477 56.01474 58.34072 55.12845 56.10838 52.70437
 [9]       NA 59.71881
> 
> colMeans(tmp5)
 [1] 111.42577  70.45058  66.57443  70.38226  70.57143  66.09395  68.21517
 [8]  70.39372  73.88138  73.57133  69.99818  72.75785  71.62893  69.76525
[15]  70.46371        NA  70.94366  71.58931  72.44852  73.69129
> colSums(tmp5)
 [1] 1114.2577  704.5058  665.7443  703.8226  705.7143  660.9395  682.1517
 [8]  703.9372  738.8138  735.7133  699.9818  727.5785  716.2893  697.6525
[15]  704.6371        NA  709.4366  715.8931  724.4852  736.9129
> colVars(tmp5)
 [1] 15965.15546    75.30223    27.42887   107.68356    87.27553    36.30959
 [7]    62.54787   102.55778   108.14945    82.21772    36.74443    68.80194
[13]   113.91474    41.92385    56.96890          NA    71.88132    71.69790
[19]    38.74798    75.85699
> colSd(tmp5)
 [1] 126.353296   8.677686   5.237257  10.377069   9.342137   6.025744
 [7]   7.908721  10.127082  10.399493   9.067399   6.061718   8.294694
[13]  10.673085   6.474863   7.547774         NA   8.478285   8.467461
[19]   6.224788   8.709592
> colMax(tmp5)
 [1] 470.32003  85.24143  76.01744  84.87653  88.98916  74.41693  78.01135
 [8]  88.55411  93.88027  84.43360  77.26708  90.25615  93.19416  79.14231
[15]  83.92175        NA  84.18055  82.02133  83.96843  84.91939
> colMin(tmp5)
 [1] 59.14911 56.01474 58.54552 56.74619 58.34072 57.13231 52.70437 56.17484
 [9] 60.35930 60.57136 62.12929 62.72882 55.12845 59.31335 60.10756       NA
[17] 61.35918 56.10838 65.15793 57.51980
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.32
> Min(tmp5,na.rm=TRUE)
[1] 52.70437
> mean(tmp5,na.rm=TRUE)
[1] 72.68025
> Sum(tmp5,na.rm=TRUE)
[1] 14463.37
> Var(tmp5,na.rm=TRUE)
[1] 868.6812
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.50575 70.50794 71.73327 67.39603 69.90021 69.63664 68.06741 72.81795
 [9] 70.31300 72.80592
> rowSums(tmp5,na.rm=TRUE)
 [1] 1870.115 1410.159 1434.665 1347.921 1398.004 1392.733 1361.348 1456.359
 [9] 1335.947 1456.118
> rowVars(tmp5,na.rm=TRUE)
 [1] 7944.18115   66.93345   50.58375   58.87990   31.26906   50.11680
 [7]   49.18117  125.95344   59.36713   81.47407
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.130136  8.181287  7.112226  7.673324  5.591875  7.079322  7.012929
 [8] 11.222898  7.705007  9.026299
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.32003  84.18055  86.05745  84.43360  80.28032  80.95279  82.32292
 [8]  93.88027  80.84069  88.98916
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.31335 57.51980 60.57477 56.01474 58.34072 55.12845 56.10838 52.70437
 [9] 56.74619 59.71881
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.42577  70.45058  66.57443  70.38226  70.57143  66.09395  68.21517
 [8]  70.39372  73.88138  73.57133  69.99818  72.75785  71.62893  69.76525
[15]  70.46371  68.32248  70.94366  71.58931  72.44852  73.69129
> colSums(tmp5,na.rm=TRUE)
 [1] 1114.2577  704.5058  665.7443  703.8226  705.7143  660.9395  682.1517
 [8]  703.9372  738.8138  735.7133  699.9818  727.5785  716.2893  697.6525
[15]  704.6371  614.9023  709.4366  715.8931  724.4852  736.9129
> colVars(tmp5,na.rm=TRUE)
 [1] 15965.15546    75.30223    27.42887   107.68356    87.27553    36.30959
 [7]    62.54787   102.55778   108.14945    82.21772    36.74443    68.80194
[13]   113.91474    41.92385    56.96890    29.71667    71.88132    71.69790
[19]    38.74798    75.85699
> colSd(tmp5,na.rm=TRUE)
 [1] 126.353296   8.677686   5.237257  10.377069   9.342137   6.025744
 [7]   7.908721  10.127082  10.399493   9.067399   6.061718   8.294694
[13]  10.673085   6.474863   7.547774   5.451300   8.478285   8.467461
[19]   6.224788   8.709592
> colMax(tmp5,na.rm=TRUE)
 [1] 470.32003  85.24143  76.01744  84.87653  88.98916  74.41693  78.01135
 [8]  88.55411  93.88027  84.43360  77.26708  90.25615  93.19416  79.14231
[15]  83.92175  76.98835  84.18055  82.02133  83.96843  84.91939
> colMin(tmp5,na.rm=TRUE)
 [1] 59.14911 56.01474 58.54552 56.74619 58.34072 57.13231 52.70437 56.17484
 [9] 60.35930 60.57136 62.12929 62.72882 55.12845 59.31335 60.10756 60.57477
[17] 61.35918 56.10838 65.15793 57.51980
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.50575 70.50794 71.73327 67.39603 69.90021 69.63664 68.06741 72.81795
 [9]      NaN 72.80592
> rowSums(tmp5,na.rm=TRUE)
 [1] 1870.115 1410.159 1434.665 1347.921 1398.004 1392.733 1361.348 1456.359
 [9]    0.000 1456.118
> rowVars(tmp5,na.rm=TRUE)
 [1] 7944.18115   66.93345   50.58375   58.87990   31.26906   50.11680
 [7]   49.18117  125.95344         NA   81.47407
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.130136  8.181287  7.112226  7.673324  5.591875  7.079322  7.012929
 [8] 11.222898        NA  9.026299
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.32003  84.18055  86.05745  84.43360  80.28032  80.95279  82.32292
 [8]  93.88027        NA  88.98916
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.31335 57.51980 60.57477 56.01474 58.34072 55.12845 56.10838 52.70437
 [9]       NA 59.71881
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.73742  71.12323  66.67628  71.89738  70.90984  65.16918  68.97588
 [8]  69.58109  75.38384  72.76362  69.29758  73.31791  72.42141  68.95433
[15]  71.02536       NaN  69.85710  71.07213  72.18093  72.93551
> colSums(tmp5,na.rm=TRUE)
 [1] 1050.6368  640.1091  600.0866  647.0764  638.1886  586.5226  620.7829
 [8]  626.2298  678.4545  654.8726  623.6783  659.8612  651.7927  620.5890
[15]  639.2283    0.0000  628.7139  639.6492  649.6284  656.4196
> colVars(tmp5,na.rm=TRUE)
 [1] 17643.39591    79.62487    30.74077    95.31867    96.89657    31.22718
 [7]    63.85632   107.94838    96.27274    85.15556    35.81559    73.87343
[13]   121.08894    39.76642    60.54113          NA    67.58450    77.65108
[19]    42.78596    78.91308
> colSd(tmp5,na.rm=TRUE)
 [1] 132.828445   8.923277   5.544436   9.763128   9.843606   5.588129
 [7]   7.991015  10.389821   9.811867   9.227977   5.984613   8.594965
[13]  11.004042   6.306062   7.780818         NA   8.220979   8.811985
[19]   6.541098   8.883304
> colMax(tmp5,na.rm=TRUE)
 [1] 470.32003  85.24143  76.01744  84.87653  88.98916  73.09708  78.01135
 [8]  88.55411  93.88027  84.43360  77.26708  90.25615  93.19416  79.14231
[15]  83.92175      -Inf  84.18055  82.02133  83.96843  84.91939
> colMin(tmp5,na.rm=TRUE)
 [1] 59.14911 56.01474 58.54552 57.85018 58.34072 57.13231 52.70437 56.17484
 [9] 65.47515 60.57136 62.12929 62.72882 55.12845 59.31335 60.10756      Inf
[17] 61.35918 56.10838 65.15793 57.51980
> 
> 
> 
> 
> 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] 133.42198 286.65526 172.48789 285.63979 163.86231 183.35475 122.94278
 [8]  94.27035 214.39963 213.99676
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 133.42198 286.65526 172.48789 285.63979 163.86231 183.35475 122.94278
 [8]  94.27035 214.39963 213.99676
> 
> 
> 
> 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] -1.136868e-13  0.000000e+00  2.842171e-14  7.815970e-14 -5.684342e-14
 [6]  1.705303e-13 -1.705303e-13  0.000000e+00 -2.842171e-14 -5.684342e-14
[11]  3.126388e-13 -5.684342e-14  2.842171e-14  1.421085e-13  0.000000e+00
[16]  0.000000e+00 -7.105427e-14  5.684342e-14  2.273737e-13  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
7   8 
9   14 
8   3 
10   4 
3   1 
2   4 
4   1 
5   3 
9   10 
1   12 
1   7 
9   3 
1   11 
1   1 
8   15 
10   9 
7   13 
4   12 
10   3 
10   20 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.32536
> Min(tmp)
[1] -2.838971
> mean(tmp)
[1] 0.1008887
> Sum(tmp)
[1] 10.08887
> Var(tmp)
[1] 0.804032
> 
> rowMeans(tmp)
[1] 0.1008887
> rowSums(tmp)
[1] 10.08887
> rowVars(tmp)
[1] 0.804032
> rowSd(tmp)
[1] 0.8966783
> rowMax(tmp)
[1] 2.32536
> rowMin(tmp)
[1] -2.838971
> 
> colMeans(tmp)
  [1]  1.01863742 -0.82069977 -0.79853230  1.49649234  0.97763617 -0.22538846
  [7] -0.85480949 -0.14895079  0.07738192  0.84186301  0.52753178 -0.67324678
 [13] -0.08815088  0.61548919 -0.54026847  0.92138888 -0.80270602  0.83755496
 [19]  1.06071178  0.88049045 -0.35641257  1.11677880  0.46759984 -0.07002678
 [25]  1.01396585  0.25585059  0.42103854  0.95922032 -0.03092486 -0.61341118
 [31] -0.85494606  2.32535959  1.91702534 -1.07119814  0.83922917 -0.88964551
 [37]  1.17420077 -1.29244030 -0.73068584 -1.09887659 -1.21328897 -0.54992260
 [43]  1.09388233  0.78503377  1.62122849  0.37016986  0.41257887 -0.67313687
 [49]  0.64503292 -0.16578938 -0.12720722 -1.17145262 -1.18818356 -1.53550214
 [55]  0.45815134  0.85051715 -0.94527708 -0.46844216  1.37992242 -0.95564282
 [61] -0.52091927  0.55162092  0.84109390  0.19346950 -0.30879257  0.23242652
 [67]  1.24623361 -2.07091798 -0.97874023 -0.04446899 -0.31598999 -0.17356320
 [73]  0.48667314  1.31640386  0.94438333 -0.12423463  0.37965315  0.11690647
 [79]  1.19350612  1.20875800 -0.60696647  0.30489191 -0.71563421 -0.16314714
 [85]  0.62054297  0.37256189  0.16975843  0.77338419  0.47733525  0.23500955
 [91]  0.54670801  1.01679795  0.13265547  0.51660733  0.69053400 -0.36448635
 [97] -2.83897147  0.35348579 -1.03966266 -0.97282980
> colSums(tmp)
  [1]  1.01863742 -0.82069977 -0.79853230  1.49649234  0.97763617 -0.22538846
  [7] -0.85480949 -0.14895079  0.07738192  0.84186301  0.52753178 -0.67324678
 [13] -0.08815088  0.61548919 -0.54026847  0.92138888 -0.80270602  0.83755496
 [19]  1.06071178  0.88049045 -0.35641257  1.11677880  0.46759984 -0.07002678
 [25]  1.01396585  0.25585059  0.42103854  0.95922032 -0.03092486 -0.61341118
 [31] -0.85494606  2.32535959  1.91702534 -1.07119814  0.83922917 -0.88964551
 [37]  1.17420077 -1.29244030 -0.73068584 -1.09887659 -1.21328897 -0.54992260
 [43]  1.09388233  0.78503377  1.62122849  0.37016986  0.41257887 -0.67313687
 [49]  0.64503292 -0.16578938 -0.12720722 -1.17145262 -1.18818356 -1.53550214
 [55]  0.45815134  0.85051715 -0.94527708 -0.46844216  1.37992242 -0.95564282
 [61] -0.52091927  0.55162092  0.84109390  0.19346950 -0.30879257  0.23242652
 [67]  1.24623361 -2.07091798 -0.97874023 -0.04446899 -0.31598999 -0.17356320
 [73]  0.48667314  1.31640386  0.94438333 -0.12423463  0.37965315  0.11690647
 [79]  1.19350612  1.20875800 -0.60696647  0.30489191 -0.71563421 -0.16314714
 [85]  0.62054297  0.37256189  0.16975843  0.77338419  0.47733525  0.23500955
 [91]  0.54670801  1.01679795  0.13265547  0.51660733  0.69053400 -0.36448635
 [97] -2.83897147  0.35348579 -1.03966266 -0.97282980
> 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.01863742 -0.82069977 -0.79853230  1.49649234  0.97763617 -0.22538846
  [7] -0.85480949 -0.14895079  0.07738192  0.84186301  0.52753178 -0.67324678
 [13] -0.08815088  0.61548919 -0.54026847  0.92138888 -0.80270602  0.83755496
 [19]  1.06071178  0.88049045 -0.35641257  1.11677880  0.46759984 -0.07002678
 [25]  1.01396585  0.25585059  0.42103854  0.95922032 -0.03092486 -0.61341118
 [31] -0.85494606  2.32535959  1.91702534 -1.07119814  0.83922917 -0.88964551
 [37]  1.17420077 -1.29244030 -0.73068584 -1.09887659 -1.21328897 -0.54992260
 [43]  1.09388233  0.78503377  1.62122849  0.37016986  0.41257887 -0.67313687
 [49]  0.64503292 -0.16578938 -0.12720722 -1.17145262 -1.18818356 -1.53550214
 [55]  0.45815134  0.85051715 -0.94527708 -0.46844216  1.37992242 -0.95564282
 [61] -0.52091927  0.55162092  0.84109390  0.19346950 -0.30879257  0.23242652
 [67]  1.24623361 -2.07091798 -0.97874023 -0.04446899 -0.31598999 -0.17356320
 [73]  0.48667314  1.31640386  0.94438333 -0.12423463  0.37965315  0.11690647
 [79]  1.19350612  1.20875800 -0.60696647  0.30489191 -0.71563421 -0.16314714
 [85]  0.62054297  0.37256189  0.16975843  0.77338419  0.47733525  0.23500955
 [91]  0.54670801  1.01679795  0.13265547  0.51660733  0.69053400 -0.36448635
 [97] -2.83897147  0.35348579 -1.03966266 -0.97282980
> colMin(tmp)
  [1]  1.01863742 -0.82069977 -0.79853230  1.49649234  0.97763617 -0.22538846
  [7] -0.85480949 -0.14895079  0.07738192  0.84186301  0.52753178 -0.67324678
 [13] -0.08815088  0.61548919 -0.54026847  0.92138888 -0.80270602  0.83755496
 [19]  1.06071178  0.88049045 -0.35641257  1.11677880  0.46759984 -0.07002678
 [25]  1.01396585  0.25585059  0.42103854  0.95922032 -0.03092486 -0.61341118
 [31] -0.85494606  2.32535959  1.91702534 -1.07119814  0.83922917 -0.88964551
 [37]  1.17420077 -1.29244030 -0.73068584 -1.09887659 -1.21328897 -0.54992260
 [43]  1.09388233  0.78503377  1.62122849  0.37016986  0.41257887 -0.67313687
 [49]  0.64503292 -0.16578938 -0.12720722 -1.17145262 -1.18818356 -1.53550214
 [55]  0.45815134  0.85051715 -0.94527708 -0.46844216  1.37992242 -0.95564282
 [61] -0.52091927  0.55162092  0.84109390  0.19346950 -0.30879257  0.23242652
 [67]  1.24623361 -2.07091798 -0.97874023 -0.04446899 -0.31598999 -0.17356320
 [73]  0.48667314  1.31640386  0.94438333 -0.12423463  0.37965315  0.11690647
 [79]  1.19350612  1.20875800 -0.60696647  0.30489191 -0.71563421 -0.16314714
 [85]  0.62054297  0.37256189  0.16975843  0.77338419  0.47733525  0.23500955
 [91]  0.54670801  1.01679795  0.13265547  0.51660733  0.69053400 -0.36448635
 [97] -2.83897147  0.35348579 -1.03966266 -0.97282980
> colMedians(tmp)
  [1]  1.01863742 -0.82069977 -0.79853230  1.49649234  0.97763617 -0.22538846
  [7] -0.85480949 -0.14895079  0.07738192  0.84186301  0.52753178 -0.67324678
 [13] -0.08815088  0.61548919 -0.54026847  0.92138888 -0.80270602  0.83755496
 [19]  1.06071178  0.88049045 -0.35641257  1.11677880  0.46759984 -0.07002678
 [25]  1.01396585  0.25585059  0.42103854  0.95922032 -0.03092486 -0.61341118
 [31] -0.85494606  2.32535959  1.91702534 -1.07119814  0.83922917 -0.88964551
 [37]  1.17420077 -1.29244030 -0.73068584 -1.09887659 -1.21328897 -0.54992260
 [43]  1.09388233  0.78503377  1.62122849  0.37016986  0.41257887 -0.67313687
 [49]  0.64503292 -0.16578938 -0.12720722 -1.17145262 -1.18818356 -1.53550214
 [55]  0.45815134  0.85051715 -0.94527708 -0.46844216  1.37992242 -0.95564282
 [61] -0.52091927  0.55162092  0.84109390  0.19346950 -0.30879257  0.23242652
 [67]  1.24623361 -2.07091798 -0.97874023 -0.04446899 -0.31598999 -0.17356320
 [73]  0.48667314  1.31640386  0.94438333 -0.12423463  0.37965315  0.11690647
 [79]  1.19350612  1.20875800 -0.60696647  0.30489191 -0.71563421 -0.16314714
 [85]  0.62054297  0.37256189  0.16975843  0.77338419  0.47733525  0.23500955
 [91]  0.54670801  1.01679795  0.13265547  0.51660733  0.69053400 -0.36448635
 [97] -2.83897147  0.35348579 -1.03966266 -0.97282980
> colRanges(tmp)
         [,1]       [,2]       [,3]     [,4]      [,5]       [,6]       [,7]
[1,] 1.018637 -0.8206998 -0.7985323 1.496492 0.9776362 -0.2253885 -0.8548095
[2,] 1.018637 -0.8206998 -0.7985323 1.496492 0.9776362 -0.2253885 -0.8548095
           [,8]       [,9]    [,10]     [,11]      [,12]       [,13]     [,14]
[1,] -0.1489508 0.07738192 0.841863 0.5275318 -0.6732468 -0.08815088 0.6154892
[2,] -0.1489508 0.07738192 0.841863 0.5275318 -0.6732468 -0.08815088 0.6154892
          [,15]     [,16]     [,17]    [,18]    [,19]     [,20]      [,21]
[1,] -0.5402685 0.9213889 -0.802706 0.837555 1.060712 0.8804904 -0.3564126
[2,] -0.5402685 0.9213889 -0.802706 0.837555 1.060712 0.8804904 -0.3564126
        [,22]     [,23]       [,24]    [,25]     [,26]     [,27]     [,28]
[1,] 1.116779 0.4675998 -0.07002678 1.013966 0.2558506 0.4210385 0.9592203
[2,] 1.116779 0.4675998 -0.07002678 1.013966 0.2558506 0.4210385 0.9592203
           [,29]      [,30]      [,31]   [,32]    [,33]     [,34]     [,35]
[1,] -0.03092486 -0.6134112 -0.8549461 2.32536 1.917025 -1.071198 0.8392292
[2,] -0.03092486 -0.6134112 -0.8549461 2.32536 1.917025 -1.071198 0.8392292
          [,36]    [,37]    [,38]      [,39]     [,40]     [,41]      [,42]
[1,] -0.8896455 1.174201 -1.29244 -0.7306858 -1.098877 -1.213289 -0.5499226
[2,] -0.8896455 1.174201 -1.29244 -0.7306858 -1.098877 -1.213289 -0.5499226
        [,43]     [,44]    [,45]     [,46]     [,47]      [,48]     [,49]
[1,] 1.093882 0.7850338 1.621228 0.3701699 0.4125789 -0.6731369 0.6450329
[2,] 1.093882 0.7850338 1.621228 0.3701699 0.4125789 -0.6731369 0.6450329
          [,50]      [,51]     [,52]     [,53]     [,54]     [,55]     [,56]
[1,] -0.1657894 -0.1272072 -1.171453 -1.188184 -1.535502 0.4581513 0.8505172
[2,] -0.1657894 -0.1272072 -1.171453 -1.188184 -1.535502 0.4581513 0.8505172
          [,57]      [,58]    [,59]      [,60]      [,61]     [,62]     [,63]
[1,] -0.9452771 -0.4684422 1.379922 -0.9556428 -0.5209193 0.5516209 0.8410939
[2,] -0.9452771 -0.4684422 1.379922 -0.9556428 -0.5209193 0.5516209 0.8410939
         [,64]      [,65]     [,66]    [,67]     [,68]      [,69]       [,70]
[1,] 0.1934695 -0.3087926 0.2324265 1.246234 -2.070918 -0.9787402 -0.04446899
[2,] 0.1934695 -0.3087926 0.2324265 1.246234 -2.070918 -0.9787402 -0.04446899
        [,71]      [,72]     [,73]    [,74]     [,75]      [,76]     [,77]
[1,] -0.31599 -0.1735632 0.4866731 1.316404 0.9443833 -0.1242346 0.3796532
[2,] -0.31599 -0.1735632 0.4866731 1.316404 0.9443833 -0.1242346 0.3796532
         [,78]    [,79]    [,80]      [,81]     [,82]      [,83]      [,84]
[1,] 0.1169065 1.193506 1.208758 -0.6069665 0.3048919 -0.7156342 -0.1631471
[2,] 0.1169065 1.193506 1.208758 -0.6069665 0.3048919 -0.7156342 -0.1631471
        [,85]     [,86]     [,87]     [,88]     [,89]     [,90]    [,91]
[1,] 0.620543 0.3725619 0.1697584 0.7733842 0.4773353 0.2350095 0.546708
[2,] 0.620543 0.3725619 0.1697584 0.7733842 0.4773353 0.2350095 0.546708
        [,92]     [,93]     [,94]    [,95]      [,96]     [,97]     [,98]
[1,] 1.016798 0.1326555 0.5166073 0.690534 -0.3644864 -2.838971 0.3534858
[2,] 1.016798 0.1326555 0.5166073 0.690534 -0.3644864 -2.838971 0.3534858
         [,99]     [,100]
[1,] -1.039663 -0.9728298
[2,] -1.039663 -0.9728298
> 
> 
> Max(tmp2)
[1] 2.664634
> Min(tmp2)
[1] -2.309347
> mean(tmp2)
[1] -0.1585989
> Sum(tmp2)
[1] -15.85989
> Var(tmp2)
[1] 1.117767
> 
> rowMeans(tmp2)
  [1] -1.75903498 -1.17839320 -0.73746988 -0.94179411 -0.01382071  0.83974635
  [7] -1.05537549 -1.11666625 -1.18507751 -0.25304645  1.03478113 -0.10119811
 [13] -1.09738021 -0.80977904 -0.16322547  2.66463407 -0.38190580 -0.28186805
 [19] -1.48294891 -1.11852002 -0.30883958 -0.45801258 -0.86787131  0.26746190
 [25] -0.89330664  1.15156863 -1.24686970 -1.28478589  0.45283715 -1.52313416
 [31] -1.06301240  0.60155407 -0.15668130  0.18643031  0.05076158 -0.46088318
 [37]  0.11063008 -0.13435357  1.90553735  1.57589442 -1.65162507 -2.19889495
 [43] -0.95996380  0.47637993 -0.26160139 -1.04817704  0.74494470 -0.97829634
 [49]  1.25621670  1.75284701  0.15453832  0.36927055 -0.21629606  0.68949343
 [55]  1.35186869 -1.61950101 -2.24856792  1.70890541 -0.44909970 -0.61840050
 [61]  1.54597924 -1.48797957  0.61410665  1.62904053 -2.30934739  0.10473736
 [67]  0.64313169  0.12934985 -0.17653494 -0.70284107 -1.59724912 -0.80422374
 [73]  0.05409282 -0.49408774  0.10467939 -0.06839284 -0.51118724 -0.29060323
 [79] -1.61518282 -0.40868521 -0.94779413  0.61315333 -0.31950299  1.68085500
 [85] -0.14405947  1.68224176  1.68749334 -0.67090046  1.72762303  1.43025947
 [91] -0.68601135 -0.55871141  1.55955998 -1.35333449 -0.73359072 -0.51327214
 [97]  0.12054563  0.68360756 -0.28017379 -0.21730541
> rowSums(tmp2)
  [1] -1.75903498 -1.17839320 -0.73746988 -0.94179411 -0.01382071  0.83974635
  [7] -1.05537549 -1.11666625 -1.18507751 -0.25304645  1.03478113 -0.10119811
 [13] -1.09738021 -0.80977904 -0.16322547  2.66463407 -0.38190580 -0.28186805
 [19] -1.48294891 -1.11852002 -0.30883958 -0.45801258 -0.86787131  0.26746190
 [25] -0.89330664  1.15156863 -1.24686970 -1.28478589  0.45283715 -1.52313416
 [31] -1.06301240  0.60155407 -0.15668130  0.18643031  0.05076158 -0.46088318
 [37]  0.11063008 -0.13435357  1.90553735  1.57589442 -1.65162507 -2.19889495
 [43] -0.95996380  0.47637993 -0.26160139 -1.04817704  0.74494470 -0.97829634
 [49]  1.25621670  1.75284701  0.15453832  0.36927055 -0.21629606  0.68949343
 [55]  1.35186869 -1.61950101 -2.24856792  1.70890541 -0.44909970 -0.61840050
 [61]  1.54597924 -1.48797957  0.61410665  1.62904053 -2.30934739  0.10473736
 [67]  0.64313169  0.12934985 -0.17653494 -0.70284107 -1.59724912 -0.80422374
 [73]  0.05409282 -0.49408774  0.10467939 -0.06839284 -0.51118724 -0.29060323
 [79] -1.61518282 -0.40868521 -0.94779413  0.61315333 -0.31950299  1.68085500
 [85] -0.14405947  1.68224176  1.68749334 -0.67090046  1.72762303  1.43025947
 [91] -0.68601135 -0.55871141  1.55955998 -1.35333449 -0.73359072 -0.51327214
 [97]  0.12054563  0.68360756 -0.28017379 -0.21730541
> 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.75903498 -1.17839320 -0.73746988 -0.94179411 -0.01382071  0.83974635
  [7] -1.05537549 -1.11666625 -1.18507751 -0.25304645  1.03478113 -0.10119811
 [13] -1.09738021 -0.80977904 -0.16322547  2.66463407 -0.38190580 -0.28186805
 [19] -1.48294891 -1.11852002 -0.30883958 -0.45801258 -0.86787131  0.26746190
 [25] -0.89330664  1.15156863 -1.24686970 -1.28478589  0.45283715 -1.52313416
 [31] -1.06301240  0.60155407 -0.15668130  0.18643031  0.05076158 -0.46088318
 [37]  0.11063008 -0.13435357  1.90553735  1.57589442 -1.65162507 -2.19889495
 [43] -0.95996380  0.47637993 -0.26160139 -1.04817704  0.74494470 -0.97829634
 [49]  1.25621670  1.75284701  0.15453832  0.36927055 -0.21629606  0.68949343
 [55]  1.35186869 -1.61950101 -2.24856792  1.70890541 -0.44909970 -0.61840050
 [61]  1.54597924 -1.48797957  0.61410665  1.62904053 -2.30934739  0.10473736
 [67]  0.64313169  0.12934985 -0.17653494 -0.70284107 -1.59724912 -0.80422374
 [73]  0.05409282 -0.49408774  0.10467939 -0.06839284 -0.51118724 -0.29060323
 [79] -1.61518282 -0.40868521 -0.94779413  0.61315333 -0.31950299  1.68085500
 [85] -0.14405947  1.68224176  1.68749334 -0.67090046  1.72762303  1.43025947
 [91] -0.68601135 -0.55871141  1.55955998 -1.35333449 -0.73359072 -0.51327214
 [97]  0.12054563  0.68360756 -0.28017379 -0.21730541
> rowMin(tmp2)
  [1] -1.75903498 -1.17839320 -0.73746988 -0.94179411 -0.01382071  0.83974635
  [7] -1.05537549 -1.11666625 -1.18507751 -0.25304645  1.03478113 -0.10119811
 [13] -1.09738021 -0.80977904 -0.16322547  2.66463407 -0.38190580 -0.28186805
 [19] -1.48294891 -1.11852002 -0.30883958 -0.45801258 -0.86787131  0.26746190
 [25] -0.89330664  1.15156863 -1.24686970 -1.28478589  0.45283715 -1.52313416
 [31] -1.06301240  0.60155407 -0.15668130  0.18643031  0.05076158 -0.46088318
 [37]  0.11063008 -0.13435357  1.90553735  1.57589442 -1.65162507 -2.19889495
 [43] -0.95996380  0.47637993 -0.26160139 -1.04817704  0.74494470 -0.97829634
 [49]  1.25621670  1.75284701  0.15453832  0.36927055 -0.21629606  0.68949343
 [55]  1.35186869 -1.61950101 -2.24856792  1.70890541 -0.44909970 -0.61840050
 [61]  1.54597924 -1.48797957  0.61410665  1.62904053 -2.30934739  0.10473736
 [67]  0.64313169  0.12934985 -0.17653494 -0.70284107 -1.59724912 -0.80422374
 [73]  0.05409282 -0.49408774  0.10467939 -0.06839284 -0.51118724 -0.29060323
 [79] -1.61518282 -0.40868521 -0.94779413  0.61315333 -0.31950299  1.68085500
 [85] -0.14405947  1.68224176  1.68749334 -0.67090046  1.72762303  1.43025947
 [91] -0.68601135 -0.55871141  1.55955998 -1.35333449 -0.73359072 -0.51327214
 [97]  0.12054563  0.68360756 -0.28017379 -0.21730541
> 
> colMeans(tmp2)
[1] -0.1585989
> colSums(tmp2)
[1] -15.85989
> colVars(tmp2)
[1] 1.117767
> colSd(tmp2)
[1] 1.057245
> colMax(tmp2)
[1] 2.664634
> colMin(tmp2)
[1] -2.309347
> colMedians(tmp2)
[1] -0.2708876
> colRanges(tmp2)
          [,1]
[1,] -2.309347
[2,]  2.664634
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.8023789  4.7343610 -1.2260472 -2.1789247  1.4497106 -3.1025120
 [7]  6.0262642  0.5913586  4.4400923  1.8750916
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3638796
[2,] -0.7101724
[3,] -0.1783424
[4,]  0.2206065
[5,]  1.1008370
> 
> rowApply(tmp,sum)
 [1]  0.4414392 -3.4343288  2.3718469  6.3210514 -2.2458837  1.8772579
 [7]  1.4493486  4.3225799 -2.9781762  2.6818805
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    6    2    6    7    7    5    1    4     1
 [2,]    9    4    3    7    8    9    9    8    5     6
 [3,]    2    1    8    2   10    5    2    9    6     2
 [4,]    1    8    5    8    1    3    7    4    7     5
 [5,]    7   10    9    9    2    6    4    3    1     3
 [6,]    4    5   10    1    3    4    3    2    3     9
 [7,]    5    9    7    4    6    2   10    6   10    10
 [8,]   10    2    6   10    4    1    8    5    2     7
 [9,]    8    3    1    5    9   10    1    7    9     8
[10,]    3    7    4    3    5    8    6   10    8     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.51604258  1.91386771 -2.43898799  5.41796481  2.14705730  1.47219230
 [7]  1.11595034 -3.62997999 -1.07839142 -2.25500845  1.45888285 -4.29334189
[13]  0.45572098 -0.08697756  1.32146619 -2.08707191 -0.49078283  1.68101864
[19]  2.47682403 -4.20519578
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.6660180
[2,] -0.5777535
[3,] -0.3078481
[4,]  0.1017344
[5,]  0.9338426
> 
> rowApply(tmp,sum)
[1]  2.1991707  1.0664562 -3.6604372 -3.0792670  0.8532421
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    5    5   13    1   18
[2,]   18   12   14   11   10
[3,]   17    8   11    2    1
[4,]   13   19   20   20   15
[5,]   11   18    9   16   12
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]      [,4]       [,5]       [,6]
[1,] -0.5777535  1.2155126  1.06628331 0.7997800  0.3963291 -0.5048912
[2,] -0.3078481  0.4972576 -0.13283987 1.0231315  1.0179290 -1.4413115
[3,]  0.1017344  0.2478047 -0.01467222 0.9787974 -0.1363793  0.9468156
[4,] -1.6660180 -0.1846226 -1.51268563 2.1144631  0.6808817  1.2809266
[5,]  0.9338426  0.1379154 -1.84507358 0.5017928  0.1882968  1.1906528
           [,7]       [,8]       [,9]       [,10]       [,11]      [,12]
[1,]  0.0991355 -2.7428893  1.0455464 -1.69310671  0.91109044  0.3358810
[2,]  0.9669559  0.6345076 -0.2887694 -0.35816308 -0.01843642 -3.3294419
[3,] -1.0433834 -1.7603557  0.4784281 -1.10922590  0.01129006 -0.4390283
[4,]  0.9291660 -0.6728939 -1.4842600  0.03732371  0.44451126 -0.6139556
[5,]  0.1640763  0.9116513 -0.8293365  0.86816353  0.11042751 -0.2467971
           [,13]       [,14]        [,15]       [,16]      [,17]      [,18]
[1,]  0.64099015  0.09354986  0.873155966 -0.39716090 -0.6608240  1.4393408
[2,]  0.10061605  0.72516681  0.004045274  0.66858760 -0.2513466 -0.4813751
[3,]  0.25889814 -1.03827452 -0.757562762 -1.36557998  0.6130807  0.7951651
[4,] -0.55902792 -0.15134774 -0.617496930 -0.94097811  1.2309758 -0.5067779
[5,]  0.01424455  0.28392803  1.819324640 -0.05194051 -1.4226686  0.4346658
           [,19]      [,20]
[1,]  1.53269001 -1.6734888
[2,]  1.22143327  0.8163575
[3,] -0.05527934 -0.3727100
[4,]  0.47887494 -1.3663259
[5,] -0.70089484 -1.6090286
> 
> 
> 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.11-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.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  634  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.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  546  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.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2      col3       col4       col5     col6       col7
row1 0.7294001 -0.171716 0.2685329 -0.6960295 -0.8038048 1.290973 -0.5184532
            col8      col9       col10    col11      col12      col13     col14
row1 -0.05614963 -1.099586 -0.07021907 1.463643 -0.6262533 -0.5459977 0.9522147
         col15      col16    col17     col18     col19      col20
row1 0.1445278 -0.8092255 1.049838 0.5607567 0.8551421 -0.8154615
> tmp[,"col10"]
           col10
row1 -0.07021907
row2 -0.27426211
row3  0.59952597
row4  1.71039195
row5 -1.22328159
> tmp[c("row1","row5"),]
          col1       col2      col3       col4       col5       col6       col7
row1 0.7294001 -0.1717160 0.2685329 -0.6960295 -0.8038048  1.2909732 -0.5184532
row5 2.7273609 -0.8258483 1.3978067 -0.4852452 -1.6030908 -0.2500286  1.7190730
            col8       col9       col10     col11      col12      col13
row1 -0.05614963 -1.0995859 -0.07021907 1.4636435 -0.6262533 -0.5459977
row5  0.80807261 -0.6517529 -1.22328159 0.3666198 -1.1872669 -0.1325517
          col14      col15      col16      col17      col18      col19
row1  0.9522147  0.1445278 -0.8092255  1.0498385  0.5607567  0.8551421
row5 -0.8103380 -0.1949514 -0.3824849 -0.1687307 -1.0315319 -0.2765060
          col20
row1 -0.8154615
row5 -0.9955192
> tmp[,c("col6","col20")]
           col6       col20
row1  1.2909732 -0.81546149
row2  0.4979530 -0.63535549
row3 -1.7480859 -0.09110928
row4  0.7924760  0.38341095
row5 -0.2500286 -0.99551923
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  1.2909732 -0.8154615
row5 -0.2500286 -0.9955192
> 
> 
> 
> 
> 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 52.08772 49.7755 47.98006 50.75286 49.97107 104.3928 49.48317 50.13785
         col9    col10    col11  col12    col13    col14    col15    col16
row1 50.69334 51.83641 51.18818 49.315 48.87415 50.62694 50.19175 49.63157
        col17    col18    col19   col20
row1 50.55237 51.15402 49.81787 104.067
> tmp[,"col10"]
        col10
row1 51.83641
row2 29.00259
row3 29.84399
row4 27.94699
row5 49.70896
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.08772 49.77550 47.98006 50.75286 49.97107 104.3928 49.48317 50.13785
row5 48.32609 49.21142 49.35135 50.93837 48.23602 105.3956 50.09759 50.67219
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.69334 51.83641 51.18818 49.31500 48.87415 50.62694 50.19175 49.63157
row5 49.18778 49.70896 48.86518 50.29055 49.18193 51.32405 50.23864 50.76127
        col17    col18    col19    col20
row1 50.55237 51.15402 49.81787 104.0670
row5 49.29626 49.00234 49.38809 104.8439
> tmp[,c("col6","col20")]
          col6     col20
row1 104.39275 104.06704
row2  75.72552  73.99942
row3  74.76035  73.29966
row4  77.21520  74.04602
row5 105.39555 104.84394
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.3928 104.0670
row5 105.3956 104.8439
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.3928 104.0670
row5 105.3956 104.8439
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
            col13
[1,]  0.692394417
[2,] -0.318085636
[3,]  0.567896860
[4,]  0.656686563
[5,] -0.009381419
> tmp[,c("col17","col7")]
           col17        col7
[1,]  0.41657820  1.37826397
[2,]  0.43561495  0.03818271
[3,] -1.10702288  0.85839575
[4,] -0.44768791  0.71734619
[5,] -0.02515021 -1.82899421
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6       col20
[1,] -0.04717718  1.00930745
[2,] -0.53416933 -0.09486178
[3,] -0.83585030  0.83832624
[4,] -0.72984299  0.91659471
[5,]  0.34379382 -0.79683564
> subBufferedMatrix(tmp,1,c("col6"))[,1]
            col1
[1,] -0.04717718
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.04717718
[2,] -0.53416933
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]     [,4]       [,5]       [,6]       [,7]
row3 -0.3698378  0.1763396 -0.1479347 1.068302  0.4848696 -1.3638507  1.5200993
row1 -1.9662924 -2.8980313 -0.3274495 0.628012 -1.2886111  0.5715451 -0.5645068
            [,8]       [,9]      [,10]      [,11]    [,12]      [,13]
row3  1.12137647  0.7185459 -0.4986462 -1.4815381 1.910587  0.2830386
row1 -0.09036605 -1.4552219 -0.1254079 -0.6744328 1.148355 -1.0119897
           [,14]      [,15]      [,16]      [,17]      [,18]     [,19]
row3 -0.01013609 -0.7359391 -0.7979678 -0.1816015  0.3737824 -1.953190
row1  0.97524991 -0.2851940 -1.0728575  1.3985807 -1.1244988  1.252666
         [,20]
row3 0.5862775
row1 0.7585269
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]        [,2]      [,3]      [,4]      [,5]       [,6]       [,7]
row2 -0.6175808 -0.08303918 0.8118912 -2.782456 -1.228953 -0.5018461 -0.7660558
          [,8]      [,9]     [,10]
row2 -2.437926 -1.578214 0.4732396
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]     [,4]      [,5]    [,6]       [,7]
row5 0.4612282 -0.7629725 0.4291136 1.337844 -2.165915 0.97267 -0.7264068
          [,8]      [,9]     [,10]     [,11]      [,12]     [,13]     [,14]
row5 -0.724574 0.7511983 0.0260571 0.6027472 -0.5400436 0.8539997 0.4919363
        [,15]     [,16]    [,17]    [,18]      [,19]    [,20]
row5 1.468425 -1.299625 1.733204 1.446385 -0.7965739 1.768223
> 
> 
> 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: 0x02825cf8>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91461101922"
 [2] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91431486588"
 [3] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM9143fa238bf"
 [4] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91422907ad6"
 [5] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM914638e48b" 
 [6] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM914326c465a"
 [7] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM914c1a350b" 
 [8] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91438dffd5" 
 [9] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM9146514743f"
[10] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91470d6166a"
[11] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM914365b6876"
[12] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM91443c4120e"
[13] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM9142ca16166"
[14] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM9147889693a"
[15] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM9141f6e5b7c"
> 
> 
> ### 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: 0x03e3b818>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x03e3b818>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.11-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x03e3b818>
> rowMedians(tmp)
  [1] -0.234915979 -0.090498466 -0.022697521 -0.176762452  0.202150342
  [6] -0.151127965  0.645408862 -0.272441380 -0.218282470  0.596670304
 [11]  0.346654398 -0.053940039 -0.476313285 -0.553053202  0.306441306
 [16] -0.111991784 -0.051056563 -0.234210884 -0.081867152 -0.049851041
 [21]  0.063204432  0.173863479 -0.175932108 -0.441654345  0.399952706
 [26]  0.294264287  0.165840960 -0.412306456  0.569521521  0.352191013
 [31]  0.101287684 -0.555497245  0.031290603 -0.132912268  0.318721417
 [36] -0.072987723  0.042868788  0.220421547 -0.366122590  0.112325232
 [41]  0.508773746 -0.354564952  0.140723713  0.711859958 -0.018281075
 [46]  0.391388860  0.068994095  0.218184246  0.069737606 -0.337058587
 [51]  0.463387153  0.143817450  0.297688097 -0.075393767  0.424120984
 [56]  0.602188387 -0.310024954 -0.045384657 -0.480693480 -0.170056275
 [61] -0.928458911 -0.157982839  0.340660889  0.334790159 -0.162409065
 [66] -0.044036720 -0.054028397 -0.604858734 -0.562714948 -0.016888951
 [71] -0.507181940  0.384199278 -0.180837401 -0.251439973  0.024763168
 [76]  0.078105794  0.302827219 -0.605785490  0.339213022 -0.720821902
 [81]  0.431062239 -0.288386849  0.040358644  0.590889828 -0.181146008
 [86]  0.021516944  0.226882401 -0.032355640 -0.449127459  0.241131258
 [91]  0.490997774  0.115836975  0.019201318  0.107226297  0.538404830
 [96]  0.186863304 -0.467473559 -0.166185578  0.233688943  0.117362614
[101]  0.147544939 -0.673071627 -0.299088236  0.175080805  0.255567025
[106] -0.141412829 -0.269446513  0.141953651 -0.373933774 -0.184142208
[111]  0.082565127 -0.090934522 -0.145580651 -0.554831335  0.377619553
[116]  0.046539434  0.112006736 -0.116082795 -0.147522717  0.287808538
[121]  0.172337810 -0.500840059  0.075516005  0.035815373  0.326831071
[126] -0.387121187 -0.173292817  0.281155425 -0.352849502 -0.011331354
[131]  0.202917198  0.384906994 -0.096206870  0.423606234 -0.495517340
[136]  0.318640311  0.233780906  0.093852991 -0.103132097 -0.548016951
[141]  0.007234551 -0.157174823  0.186035676 -0.029457366 -0.139592164
[146]  0.133505372 -0.404356169 -0.531115690 -0.412038343 -0.363387987
[151] -0.473001502  0.369592083 -0.515088544 -0.050093699 -0.397621313
[156]  0.109892214 -0.035130827 -0.581655376 -0.152136188 -0.033770655
[161]  0.066244250 -0.125102980 -0.545015671  0.124108148  0.259154598
[166] -0.146442641  0.422586097 -0.965303414  0.781283592 -0.241337258
[171]  0.192773629 -0.021297122  0.728052835 -0.244439070  0.113295633
[176] -0.098356205 -0.016421030 -0.623966329 -0.065977007  0.447849948
[181] -0.691641779 -0.328053561  0.426705543  0.009923658 -0.365554005
[186]  0.025669419  0.311491785  0.416987260 -0.030151561  0.252074776
[191] -0.120393394 -0.086512926 -0.155075345  0.107699963  0.131838093
[196]  0.513684181 -0.119636059  0.030512938  0.111953686 -0.150054572
[201]  0.113308087 -0.055638518 -0.072672478  0.045834575 -0.079062786
[206] -0.046660258  0.047886497  0.217329664 -0.128323720  0.019069002
[211]  0.166166580  0.110024669 -0.288359775 -0.584220685  0.250858616
[216]  0.274521071 -0.334784008  0.192790674 -0.341840862 -0.205465841
[221] -0.073906504  0.089758908 -0.001088555  0.395125165 -0.083653250
[226] -0.141389657  0.407651034 -0.432010542 -0.255817086  0.342626870
> 
> proc.time()
   user  system elapsed 
   2.82    7.54   10.78 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.11-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 434275 23.2     919948 49.2   641674 34.3
Vcells 751936  5.8    8388608 64.0  1683775 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] "Sat Oct 17 02:09:12 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Oct 17 02:09:12 2020"
> 
> 
> 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: 0x0000000007581620>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Oct 17 02:09:15 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Oct 17 02:09:16 2020"
> 
> ColMode(tmp2)
<pointer: 0x0000000007581620>
> 
> 
> 
> ### 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.4581620 -0.6074771  0.3842429 -1.77445662
[2,]  1.0615385  0.8756334 -1.1851354 -0.17520671
[3,]  0.4423536 -0.2473750  0.7961286  0.03660129
[4,] -0.3861903 -0.1696831 -1.2166765 -1.79025020
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]       [,4]
[1,] 99.4581620 0.6074771 0.3842429 1.77445662
[2,]  1.0615385 0.8756334 1.1851354 0.17520671
[3,]  0.4423536 0.2473750 0.7961286 0.03660129
[4,]  0.3861903 0.1696831 1.2166765 1.79025020
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9728713 0.7794082 0.6198733 1.3320873
[2,] 1.0303099 0.9357529 1.0886392 0.4185770
[3,] 0.6650967 0.4973681 0.8922604 0.1913146
[4,] 0.6214421 0.4119261 1.1030306 1.3380023
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.18688 33.40156 31.58298 40.09533
[2,]  36.36464 35.23316 37.07153 29.36098
[3,]  32.09332 30.22106 34.71873 26.94975
[4,]  31.60061 29.28894 37.24698 40.17027
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x000000000741a300>
> exp(tmp5)
<pointer: 0x000000000741a300>
> log(tmp5,2)
<pointer: 0x000000000741a300>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.6156
> Min(tmp5)
[1] 52.72148
> mean(tmp5)
[1] 72.40099
> Sum(tmp5)
[1] 14480.2
> Var(tmp5)
[1] 863.319
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.41369 73.35069 66.30665 73.04894 70.59089 71.58947 69.26899 71.28478
 [9] 71.20597 66.94987
> rowSums(tmp5)
 [1] 1808.274 1467.014 1326.133 1460.979 1411.818 1431.789 1385.380 1425.696
 [9] 1424.119 1338.997
> rowVars(tmp5)
 [1] 7935.80251   95.65928   37.91745   59.16822   76.73043   96.65163
 [7]  105.60450   51.45719   79.12184   73.43462
> rowSd(tmp5)
 [1] 89.083121  9.780556  6.157714  7.692088  8.759591  9.831156 10.276405
 [8]  7.173367  8.895046  8.569400
> rowMax(tmp5)
 [1] 466.61561  89.64602  76.33281  87.26014  92.79495  94.04054  84.82086
 [8]  85.13079  87.74456  86.25479
> rowMin(tmp5)
 [1] 53.71617 57.76208 56.09237 60.87292 57.37921 56.42719 52.72148 59.21527
 [9] 52.83237 54.67551
> 
> colMeans(tmp5)
 [1] 109.97478  73.39268  69.95232  72.00995  75.99357  73.80570  67.74632
 [8]  72.26219  66.35949  70.25645  68.51772  67.22243  72.47240  71.21755
[15]  67.45734  67.29942  68.79879  69.84674  74.73117  68.70289
> colSums(tmp5)
 [1] 1099.7478  733.9268  699.5232  720.0995  759.9357  738.0570  677.4632
 [8]  722.6219  663.5949  702.5645  685.1772  672.2243  724.7240  712.1755
[15]  674.5734  672.9942  687.9879  698.4674  747.3117  687.0289
> colVars(tmp5)
 [1] 15718.56850    92.52344    85.01002    92.14828   105.26244   124.07369
 [7]    18.44761    57.14166   122.28246    78.91281    64.72179    54.14875
[13]   134.49154    50.10735    60.11529    18.20054    88.43529    65.93208
[19]   171.64163    76.82024
> colSd(tmp5)
 [1] 125.373715   9.618911   9.220088   9.599390  10.259748  11.138837
 [7]   4.295068   7.559211  11.058140   8.883288   8.044985   7.358583
[13]  11.597049   7.078655   7.753405   4.266209   9.404004   8.119857
[19]  13.101207   8.764716
> colMax(tmp5)
 [1] 466.61561  86.25479  85.13079  83.60916  94.04054  87.47325  73.08884
 [8]  81.92430  87.74456  87.26014  81.50158  79.49000  87.96180  83.84613
[15]  80.78392  73.94126  86.14515  87.59747  92.79495  80.92416
> colMin(tmp5)
 [1] 65.77253 60.96110 56.02680 56.09237 64.46337 54.67551 59.64945 55.81691
 [9] 54.07252 57.76208 57.17264 52.72148 56.99214 59.09114 57.37321 61.33805
[17] 53.71617 60.71824 52.83237 55.12346
> 
> 
> ### 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.41369 73.35069 66.30665 73.04894 70.59089 71.58947 69.26899 71.28478
 [9] 71.20597       NA
> rowSums(tmp5)
 [1] 1808.274 1467.014 1326.133 1460.979 1411.818 1431.789 1385.380 1425.696
 [9] 1424.119       NA
> rowVars(tmp5)
 [1] 7935.80251   95.65928   37.91745   59.16822   76.73043   96.65163
 [7]  105.60450   51.45719   79.12184   76.74446
> rowSd(tmp5)
 [1] 89.083121  9.780556  6.157714  7.692088  8.759591  9.831156 10.276405
 [8]  7.173367  8.895046  8.760392
> rowMax(tmp5)
 [1] 466.61561  89.64602  76.33281  87.26014  92.79495  94.04054  84.82086
 [8]  85.13079  87.74456        NA
> rowMin(tmp5)
 [1] 53.71617 57.76208 56.09237 60.87292 57.37921 56.42719 52.72148 59.21527
 [9] 52.83237       NA
> 
> colMeans(tmp5)
 [1] 109.97478  73.39268  69.95232  72.00995  75.99357  73.80570  67.74632
 [8]  72.26219  66.35949  70.25645  68.51772  67.22243  72.47240  71.21755
[15]  67.45734        NA  68.79879  69.84674  74.73117  68.70289
> colSums(tmp5)
 [1] 1099.7478  733.9268  699.5232  720.0995  759.9357  738.0570  677.4632
 [8]  722.6219  663.5949  702.5645  685.1772  672.2243  724.7240  712.1755
[15]  674.5734        NA  687.9879  698.4674  747.3117  687.0289
> colVars(tmp5)
 [1] 15718.56850    92.52344    85.01002    92.14828   105.26244   124.07369
 [7]    18.44761    57.14166   122.28246    78.91281    64.72179    54.14875
[13]   134.49154    50.10735    60.11529          NA    88.43529    65.93208
[19]   171.64163    76.82024
> colSd(tmp5)
 [1] 125.373715   9.618911   9.220088   9.599390  10.259748  11.138837
 [7]   4.295068   7.559211  11.058140   8.883288   8.044985   7.358583
[13]  11.597049   7.078655   7.753405         NA   9.404004   8.119857
[19]  13.101207   8.764716
> colMax(tmp5)
 [1] 466.61561  86.25479  85.13079  83.60916  94.04054  87.47325  73.08884
 [8]  81.92430  87.74456  87.26014  81.50158  79.49000  87.96180  83.84613
[15]  80.78392        NA  86.14515  87.59747  92.79495  80.92416
> colMin(tmp5)
 [1] 65.77253 60.96110 56.02680 56.09237 64.46337 54.67551 59.64945 55.81691
 [9] 54.07252 57.76208 57.17264 52.72148 56.99214 59.09114 57.37321       NA
[17] 53.71617 60.71824 52.83237 55.12346
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.6156
> Min(tmp5,na.rm=TRUE)
[1] 52.72148
> mean(tmp5,na.rm=TRUE)
[1] 72.44662
> Sum(tmp5,na.rm=TRUE)
[1] 14416.88
> Var(tmp5,na.rm=TRUE)
[1] 867.2607
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.41369 73.35069 66.30665 73.04894 70.59089 71.58947 69.26899 71.28478
 [9] 71.20597 67.14083
> rowSums(tmp5,na.rm=TRUE)
 [1] 1808.274 1467.014 1326.133 1460.979 1411.818 1431.789 1385.380 1425.696
 [9] 1424.119 1275.676
> rowVars(tmp5,na.rm=TRUE)
 [1] 7935.80251   95.65928   37.91745   59.16822   76.73043   96.65163
 [7]  105.60450   51.45719   79.12184   76.74446
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.083121  9.780556  6.157714  7.692088  8.759591  9.831156 10.276405
 [8]  7.173367  8.895046  8.760392
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.61561  89.64602  76.33281  87.26014  92.79495  94.04054  84.82086
 [8]  85.13079  87.74456  86.25479
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.71617 57.76208 56.09237 60.87292 57.37921 56.42719 52.72148 59.21527
 [9] 52.83237 54.67551
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.97478  73.39268  69.95232  72.00995  75.99357  73.80570  67.74632
 [8]  72.26219  66.35949  70.25645  68.51772  67.22243  72.47240  71.21755
[15]  67.45734  67.74140  68.79879  69.84674  74.73117  68.70289
> colSums(tmp5,na.rm=TRUE)
 [1] 1099.7478  733.9268  699.5232  720.0995  759.9357  738.0570  677.4632
 [8]  722.6219  663.5949  702.5645  685.1772  672.2243  724.7240  712.1755
[15]  674.5734  609.6726  687.9879  698.4674  747.3117  687.0289
> colVars(tmp5,na.rm=TRUE)
 [1] 15718.56850    92.52344    85.01002    92.14828   105.26244   124.07369
 [7]    18.44761    57.14166   122.28246    78.91281    64.72179    54.14875
[13]   134.49154    50.10735    60.11529    18.27793    88.43529    65.93208
[19]   171.64163    76.82024
> colSd(tmp5,na.rm=TRUE)
 [1] 125.373715   9.618911   9.220088   9.599390  10.259748  11.138837
 [7]   4.295068   7.559211  11.058140   8.883288   8.044985   7.358583
[13]  11.597049   7.078655   7.753405   4.275270   9.404004   8.119857
[19]  13.101207   8.764716
> colMax(tmp5,na.rm=TRUE)
 [1] 466.61561  86.25479  85.13079  83.60916  94.04054  87.47325  73.08884
 [8]  81.92430  87.74456  87.26014  81.50158  79.49000  87.96180  83.84613
[15]  80.78392  73.94126  86.14515  87.59747  92.79495  80.92416
> colMin(tmp5,na.rm=TRUE)
 [1] 65.77253 60.96110 56.02680 56.09237 64.46337 54.67551 59.64945 55.81691
 [9] 54.07252 57.76208 57.17264 52.72148 56.99214 59.09114 57.37321 61.33805
[17] 53.71617 60.71824 52.83237 55.12346
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.41369 73.35069 66.30665 73.04894 70.59089 71.58947 69.26899 71.28478
 [9] 71.20597      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1808.274 1467.014 1326.133 1460.979 1411.818 1431.789 1385.380 1425.696
 [9] 1424.119    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 7935.80251   95.65928   37.91745   59.16822   76.73043   96.65163
 [7]  105.60450   51.45719   79.12184         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.083121  9.780556  6.157714  7.692088  8.759591  9.831156 10.276405
 [8]  7.173367  8.895046        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.61561  89.64602  76.33281  87.26014  92.79495  94.04054  84.82086
 [8]  85.13079  87.74456        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.71617 57.76208 56.09237 60.87292 57.37921 56.42719 52.72148 59.21527
 [9] 52.83237       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.19972  71.96356  71.49960  71.52166  76.02180  75.93128  67.86871
 [8]  74.08944  65.87757  70.53132  68.72285  67.79690  74.19243  71.67995
[15]  67.06500       NaN  67.45974  70.36974  75.77011  69.83072
> colSums(tmp5,na.rm=TRUE)
 [1] 1027.7974  647.6720  643.4964  643.6950  684.1962  683.3815  610.8184
 [8]  666.8050  592.8981  634.7819  618.5057  610.1721  667.7319  645.1195
[15]  603.5850    0.0000  607.1377  633.3277  681.9310  628.4764
> colVars(tmp5,na.rm=TRUE)
 [1] 17482.57634    81.11194    68.70291   100.98456   118.41128    88.75454
 [7]    20.58504    26.72227   134.95501    87.92688    72.33862    57.20457
[13]   118.01986    53.96537    65.89797          NA    79.31790    71.09640
[19]   180.95357    72.11288
> colSd(tmp5,na.rm=TRUE)
 [1] 132.221694   9.006217   8.288722  10.049107  10.881695   9.420963
 [7]   4.537074   5.169359  11.617014   9.376933   8.505211   7.563371
[13]  10.863695   7.346113   8.117756         NA   8.906060   8.431868
[19]  13.451898   8.491930
> colMax(tmp5,na.rm=TRUE)
 [1] 466.61561  84.82086  85.13079  83.60916  94.04054  87.47325  73.08884
 [8]  81.92430  87.74456  87.26014  81.50158  79.49000  87.96180  83.84613
[15]  80.78392      -Inf  86.14515  87.59747  92.79495  80.92416
> colMin(tmp5,na.rm=TRUE)
 [1] 65.77253 60.96110 58.16351 56.09237 64.46337 58.55499 59.64945 65.35321
 [9] 54.07252 57.76208 57.17264 52.72148 58.28816 59.09114 57.37321      Inf
[17] 53.71617 60.71824 52.83237 55.12346
> 
> 
> 
> 
> 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] 341.9724 158.3103 262.0444 173.8330 106.8632 192.2692 241.0180 189.1857
 [9] 193.1418 141.0814
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 341.9724 158.3103 262.0444 173.8330 106.8632 192.2692 241.0180 189.1857
 [9] 193.1418 141.0814
> 
> 
> 
> 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] -1.136868e-13 -2.842171e-14 -8.526513e-14  1.136868e-13 -1.136868e-13
 [6]  5.684342e-14 -2.273737e-13 -8.526513e-14  2.842171e-14  4.263256e-14
[11]  2.273737e-13 -1.705303e-13  1.421085e-14  0.000000e+00 -5.684342e-14
[16]  5.684342e-14  2.842171e-14 -2.842171e-14 -5.684342e-14 -8.526513e-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)
+ }
10   11 
5   10 
1   16 
3   5 
9   17 
10   7 
9   17 
1   8 
4   15 
1   3 
10   14 
4   19 
10   7 
1   19 
9   4 
4   1 
6   5 
9   17 
7   12 
10   9 
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.983764
> Min(tmp)
[1] -2.608603
> mean(tmp)
[1] -0.04571138
> Sum(tmp)
[1] -4.571138
> Var(tmp)
[1] 0.7900085
> 
> rowMeans(tmp)
[1] -0.04571138
> rowSums(tmp)
[1] -4.571138
> rowVars(tmp)
[1] 0.7900085
> rowSd(tmp)
[1] 0.8888242
> rowMax(tmp)
[1] 1.983764
> rowMin(tmp)
[1] -2.608603
> 
> colMeans(tmp)
  [1]  0.998908361  0.315853741 -0.420313902 -0.626240109  0.590075995
  [6]  1.707919683 -0.518663259  0.786799908  0.082875118 -1.297962827
 [11] -1.764932136 -0.232881512 -0.475904397 -0.114005631  0.548458220
 [16]  0.563264056 -0.410874565 -0.554931694  1.383348936 -0.342749543
 [21] -2.129218383 -0.529612510 -0.276593390 -1.410295607 -0.069183206
 [26] -0.189933293 -1.599093985 -0.005311189 -0.657441260 -1.636746105
 [31]  0.771522343  0.834794487  0.697838147  1.311224979 -0.776543984
 [36]  1.983764315 -0.042783870  0.160034608  0.164053523 -0.332621158
 [41] -0.371447511 -0.607473936 -2.608603433 -0.723783636 -0.136445526
 [46] -1.106025948 -0.447295595  1.347389251 -0.771371116 -0.681009326
 [51] -0.245566135  1.737628752  1.058114873  0.840479835 -0.418947761
 [56] -1.707480776  1.147305638 -0.610720164 -0.612981720 -0.927251786
 [61]  0.678805481  0.255346952  0.200641527  0.312403630  0.010611204
 [66] -0.726439550  0.655010682  0.356864046  0.475782676 -0.059304436
 [71] -0.949713646  0.262795883 -0.920918731 -0.752608075  1.313292473
 [76] -0.400296587  0.488934508  0.442798323 -0.382723294 -0.063627289
 [81] -0.377637649  0.555920105 -0.407372402  0.911838330  0.879360182
 [86] -0.341630938 -0.470808836  0.165162424 -0.529450038  1.361239189
 [91] -1.535156848  0.002111676  1.373005664  1.076305774 -0.967717541
 [96] -0.292407164  0.138138979  0.969664369  1.243552150 -0.163323962
> colSums(tmp)
  [1]  0.998908361  0.315853741 -0.420313902 -0.626240109  0.590075995
  [6]  1.707919683 -0.518663259  0.786799908  0.082875118 -1.297962827
 [11] -1.764932136 -0.232881512 -0.475904397 -0.114005631  0.548458220
 [16]  0.563264056 -0.410874565 -0.554931694  1.383348936 -0.342749543
 [21] -2.129218383 -0.529612510 -0.276593390 -1.410295607 -0.069183206
 [26] -0.189933293 -1.599093985 -0.005311189 -0.657441260 -1.636746105
 [31]  0.771522343  0.834794487  0.697838147  1.311224979 -0.776543984
 [36]  1.983764315 -0.042783870  0.160034608  0.164053523 -0.332621158
 [41] -0.371447511 -0.607473936 -2.608603433 -0.723783636 -0.136445526
 [46] -1.106025948 -0.447295595  1.347389251 -0.771371116 -0.681009326
 [51] -0.245566135  1.737628752  1.058114873  0.840479835 -0.418947761
 [56] -1.707480776  1.147305638 -0.610720164 -0.612981720 -0.927251786
 [61]  0.678805481  0.255346952  0.200641527  0.312403630  0.010611204
 [66] -0.726439550  0.655010682  0.356864046  0.475782676 -0.059304436
 [71] -0.949713646  0.262795883 -0.920918731 -0.752608075  1.313292473
 [76] -0.400296587  0.488934508  0.442798323 -0.382723294 -0.063627289
 [81] -0.377637649  0.555920105 -0.407372402  0.911838330  0.879360182
 [86] -0.341630938 -0.470808836  0.165162424 -0.529450038  1.361239189
 [91] -1.535156848  0.002111676  1.373005664  1.076305774 -0.967717541
 [96] -0.292407164  0.138138979  0.969664369  1.243552150 -0.163323962
> 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.998908361  0.315853741 -0.420313902 -0.626240109  0.590075995
  [6]  1.707919683 -0.518663259  0.786799908  0.082875118 -1.297962827
 [11] -1.764932136 -0.232881512 -0.475904397 -0.114005631  0.548458220
 [16]  0.563264056 -0.410874565 -0.554931694  1.383348936 -0.342749543
 [21] -2.129218383 -0.529612510 -0.276593390 -1.410295607 -0.069183206
 [26] -0.189933293 -1.599093985 -0.005311189 -0.657441260 -1.636746105
 [31]  0.771522343  0.834794487  0.697838147  1.311224979 -0.776543984
 [36]  1.983764315 -0.042783870  0.160034608  0.164053523 -0.332621158
 [41] -0.371447511 -0.607473936 -2.608603433 -0.723783636 -0.136445526
 [46] -1.106025948 -0.447295595  1.347389251 -0.771371116 -0.681009326
 [51] -0.245566135  1.737628752  1.058114873  0.840479835 -0.418947761
 [56] -1.707480776  1.147305638 -0.610720164 -0.612981720 -0.927251786
 [61]  0.678805481  0.255346952  0.200641527  0.312403630  0.010611204
 [66] -0.726439550  0.655010682  0.356864046  0.475782676 -0.059304436
 [71] -0.949713646  0.262795883 -0.920918731 -0.752608075  1.313292473
 [76] -0.400296587  0.488934508  0.442798323 -0.382723294 -0.063627289
 [81] -0.377637649  0.555920105 -0.407372402  0.911838330  0.879360182
 [86] -0.341630938 -0.470808836  0.165162424 -0.529450038  1.361239189
 [91] -1.535156848  0.002111676  1.373005664  1.076305774 -0.967717541
 [96] -0.292407164  0.138138979  0.969664369  1.243552150 -0.163323962
> colMin(tmp)
  [1]  0.998908361  0.315853741 -0.420313902 -0.626240109  0.590075995
  [6]  1.707919683 -0.518663259  0.786799908  0.082875118 -1.297962827
 [11] -1.764932136 -0.232881512 -0.475904397 -0.114005631  0.548458220
 [16]  0.563264056 -0.410874565 -0.554931694  1.383348936 -0.342749543
 [21] -2.129218383 -0.529612510 -0.276593390 -1.410295607 -0.069183206
 [26] -0.189933293 -1.599093985 -0.005311189 -0.657441260 -1.636746105
 [31]  0.771522343  0.834794487  0.697838147  1.311224979 -0.776543984
 [36]  1.983764315 -0.042783870  0.160034608  0.164053523 -0.332621158
 [41] -0.371447511 -0.607473936 -2.608603433 -0.723783636 -0.136445526
 [46] -1.106025948 -0.447295595  1.347389251 -0.771371116 -0.681009326
 [51] -0.245566135  1.737628752  1.058114873  0.840479835 -0.418947761
 [56] -1.707480776  1.147305638 -0.610720164 -0.612981720 -0.927251786
 [61]  0.678805481  0.255346952  0.200641527  0.312403630  0.010611204
 [66] -0.726439550  0.655010682  0.356864046  0.475782676 -0.059304436
 [71] -0.949713646  0.262795883 -0.920918731 -0.752608075  1.313292473
 [76] -0.400296587  0.488934508  0.442798323 -0.382723294 -0.063627289
 [81] -0.377637649  0.555920105 -0.407372402  0.911838330  0.879360182
 [86] -0.341630938 -0.470808836  0.165162424 -0.529450038  1.361239189
 [91] -1.535156848  0.002111676  1.373005664  1.076305774 -0.967717541
 [96] -0.292407164  0.138138979  0.969664369  1.243552150 -0.163323962
> colMedians(tmp)
  [1]  0.998908361  0.315853741 -0.420313902 -0.626240109  0.590075995
  [6]  1.707919683 -0.518663259  0.786799908  0.082875118 -1.297962827
 [11] -1.764932136 -0.232881512 -0.475904397 -0.114005631  0.548458220
 [16]  0.563264056 -0.410874565 -0.554931694  1.383348936 -0.342749543
 [21] -2.129218383 -0.529612510 -0.276593390 -1.410295607 -0.069183206
 [26] -0.189933293 -1.599093985 -0.005311189 -0.657441260 -1.636746105
 [31]  0.771522343  0.834794487  0.697838147  1.311224979 -0.776543984
 [36]  1.983764315 -0.042783870  0.160034608  0.164053523 -0.332621158
 [41] -0.371447511 -0.607473936 -2.608603433 -0.723783636 -0.136445526
 [46] -1.106025948 -0.447295595  1.347389251 -0.771371116 -0.681009326
 [51] -0.245566135  1.737628752  1.058114873  0.840479835 -0.418947761
 [56] -1.707480776  1.147305638 -0.610720164 -0.612981720 -0.927251786
 [61]  0.678805481  0.255346952  0.200641527  0.312403630  0.010611204
 [66] -0.726439550  0.655010682  0.356864046  0.475782676 -0.059304436
 [71] -0.949713646  0.262795883 -0.920918731 -0.752608075  1.313292473
 [76] -0.400296587  0.488934508  0.442798323 -0.382723294 -0.063627289
 [81] -0.377637649  0.555920105 -0.407372402  0.911838330  0.879360182
 [86] -0.341630938 -0.470808836  0.165162424 -0.529450038  1.361239189
 [91] -1.535156848  0.002111676  1.373005664  1.076305774 -0.967717541
 [96] -0.292407164  0.138138979  0.969664369  1.243552150 -0.163323962
> colRanges(tmp)
          [,1]      [,2]       [,3]       [,4]     [,5]    [,6]       [,7]
[1,] 0.9989084 0.3158537 -0.4203139 -0.6262401 0.590076 1.70792 -0.5186633
[2,] 0.9989084 0.3158537 -0.4203139 -0.6262401 0.590076 1.70792 -0.5186633
          [,8]       [,9]     [,10]     [,11]      [,12]      [,13]      [,14]
[1,] 0.7867999 0.08287512 -1.297963 -1.764932 -0.2328815 -0.4759044 -0.1140056
[2,] 0.7867999 0.08287512 -1.297963 -1.764932 -0.2328815 -0.4759044 -0.1140056
         [,15]     [,16]      [,17]      [,18]    [,19]      [,20]     [,21]
[1,] 0.5484582 0.5632641 -0.4108746 -0.5549317 1.383349 -0.3427495 -2.129218
[2,] 0.5484582 0.5632641 -0.4108746 -0.5549317 1.383349 -0.3427495 -2.129218
          [,22]      [,23]     [,24]       [,25]      [,26]     [,27]
[1,] -0.5296125 -0.2765934 -1.410296 -0.06918321 -0.1899333 -1.599094
[2,] -0.5296125 -0.2765934 -1.410296 -0.06918321 -0.1899333 -1.599094
            [,28]      [,29]     [,30]     [,31]     [,32]     [,33]    [,34]
[1,] -0.005311189 -0.6574413 -1.636746 0.7715223 0.8347945 0.6978381 1.311225
[2,] -0.005311189 -0.6574413 -1.636746 0.7715223 0.8347945 0.6978381 1.311225
         [,35]    [,36]       [,37]     [,38]     [,39]      [,40]      [,41]
[1,] -0.776544 1.983764 -0.04278387 0.1600346 0.1640535 -0.3326212 -0.3714475
[2,] -0.776544 1.983764 -0.04278387 0.1600346 0.1640535 -0.3326212 -0.3714475
          [,42]     [,43]      [,44]      [,45]     [,46]      [,47]    [,48]
[1,] -0.6074739 -2.608603 -0.7237836 -0.1364455 -1.106026 -0.4472956 1.347389
[2,] -0.6074739 -2.608603 -0.7237836 -0.1364455 -1.106026 -0.4472956 1.347389
          [,49]      [,50]      [,51]    [,52]    [,53]     [,54]      [,55]
[1,] -0.7713711 -0.6810093 -0.2455661 1.737629 1.058115 0.8404798 -0.4189478
[2,] -0.7713711 -0.6810093 -0.2455661 1.737629 1.058115 0.8404798 -0.4189478
         [,56]    [,57]      [,58]      [,59]      [,60]     [,61]    [,62]
[1,] -1.707481 1.147306 -0.6107202 -0.6129817 -0.9272518 0.6788055 0.255347
[2,] -1.707481 1.147306 -0.6107202 -0.6129817 -0.9272518 0.6788055 0.255347
         [,63]     [,64]     [,65]      [,66]     [,67]    [,68]     [,69]
[1,] 0.2006415 0.3124036 0.0106112 -0.7264395 0.6550107 0.356864 0.4757827
[2,] 0.2006415 0.3124036 0.0106112 -0.7264395 0.6550107 0.356864 0.4757827
           [,70]      [,71]     [,72]      [,73]      [,74]    [,75]      [,76]
[1,] -0.05930444 -0.9497136 0.2627959 -0.9209187 -0.7526081 1.313292 -0.4002966
[2,] -0.05930444 -0.9497136 0.2627959 -0.9209187 -0.7526081 1.313292 -0.4002966
         [,77]     [,78]      [,79]       [,80]      [,81]     [,82]      [,83]
[1,] 0.4889345 0.4427983 -0.3827233 -0.06362729 -0.3776376 0.5559201 -0.4073724
[2,] 0.4889345 0.4427983 -0.3827233 -0.06362729 -0.3776376 0.5559201 -0.4073724
         [,84]     [,85]      [,86]      [,87]     [,88]    [,89]    [,90]
[1,] 0.9118383 0.8793602 -0.3416309 -0.4708088 0.1651624 -0.52945 1.361239
[2,] 0.9118383 0.8793602 -0.3416309 -0.4708088 0.1651624 -0.52945 1.361239
         [,91]       [,92]    [,93]    [,94]      [,95]      [,96]    [,97]
[1,] -1.535157 0.002111676 1.373006 1.076306 -0.9677175 -0.2924072 0.138139
[2,] -1.535157 0.002111676 1.373006 1.076306 -0.9677175 -0.2924072 0.138139
         [,98]    [,99]    [,100]
[1,] 0.9696644 1.243552 -0.163324
[2,] 0.9696644 1.243552 -0.163324
> 
> 
> Max(tmp2)
[1] 2.060193
> Min(tmp2)
[1] -1.844454
> mean(tmp2)
[1] -0.05879274
> Sum(tmp2)
[1] -5.879274
> Var(tmp2)
[1] 0.8957806
> 
> rowMeans(tmp2)
  [1] -0.46560987  0.23975554 -0.61830572  0.91609330 -0.80040591  1.17657431
  [7]  0.48093919 -0.42519298  1.59245161  0.46188424 -1.58011500 -0.88795784
 [13]  1.22434777  0.48474091 -1.47072856 -1.18442250  0.82239570  0.60531211
 [19]  0.94902009 -0.44823933 -0.11775576 -1.23858676 -0.97773834 -0.58248533
 [25]  0.58513668 -0.53468802 -1.79416569 -0.44367819  0.00229523  1.20818859
 [31] -0.45533023  1.95927207 -1.84445397  0.14623416  0.54297482 -0.11681004
 [37] -0.81275850 -0.03151630  0.57870245  0.73160855 -0.14976357 -0.41036093
 [43] -1.23298014  0.10903928  0.88429900 -1.55771742  0.54514511  0.64986515
 [49]  1.33590427 -1.11356412 -0.77329575 -0.44621851 -0.15357186  1.02620367
 [55] -0.91374010  0.43873019 -1.71759339 -0.75989313  1.02339563 -0.20841232
 [61] -0.43896079 -0.78344968  1.20740919 -0.04607262  0.82391345 -0.67141123
 [67]  1.01577147  1.68849785 -0.07974321 -0.35492166 -1.08171485  1.24832806
 [73] -0.35829377 -1.76599355 -1.13462735 -1.70947941  0.41218052 -1.57101956
 [79] -0.11192618 -0.42724843  2.06019322  1.02480260  0.32780336  0.87891359
 [85]  0.76610753 -1.24703139  0.98498148  1.50938844  0.72393762  0.16997147
 [91] -0.02249599 -1.09681608 -0.53919954 -1.18752727 -0.31059653  0.55413902
 [97]  0.64606081 -0.84939404  0.25386204 -0.84006604
> rowSums(tmp2)
  [1] -0.46560987  0.23975554 -0.61830572  0.91609330 -0.80040591  1.17657431
  [7]  0.48093919 -0.42519298  1.59245161  0.46188424 -1.58011500 -0.88795784
 [13]  1.22434777  0.48474091 -1.47072856 -1.18442250  0.82239570  0.60531211
 [19]  0.94902009 -0.44823933 -0.11775576 -1.23858676 -0.97773834 -0.58248533
 [25]  0.58513668 -0.53468802 -1.79416569 -0.44367819  0.00229523  1.20818859
 [31] -0.45533023  1.95927207 -1.84445397  0.14623416  0.54297482 -0.11681004
 [37] -0.81275850 -0.03151630  0.57870245  0.73160855 -0.14976357 -0.41036093
 [43] -1.23298014  0.10903928  0.88429900 -1.55771742  0.54514511  0.64986515
 [49]  1.33590427 -1.11356412 -0.77329575 -0.44621851 -0.15357186  1.02620367
 [55] -0.91374010  0.43873019 -1.71759339 -0.75989313  1.02339563 -0.20841232
 [61] -0.43896079 -0.78344968  1.20740919 -0.04607262  0.82391345 -0.67141123
 [67]  1.01577147  1.68849785 -0.07974321 -0.35492166 -1.08171485  1.24832806
 [73] -0.35829377 -1.76599355 -1.13462735 -1.70947941  0.41218052 -1.57101956
 [79] -0.11192618 -0.42724843  2.06019322  1.02480260  0.32780336  0.87891359
 [85]  0.76610753 -1.24703139  0.98498148  1.50938844  0.72393762  0.16997147
 [91] -0.02249599 -1.09681608 -0.53919954 -1.18752727 -0.31059653  0.55413902
 [97]  0.64606081 -0.84939404  0.25386204 -0.84006604
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.46560987  0.23975554 -0.61830572  0.91609330 -0.80040591  1.17657431
  [7]  0.48093919 -0.42519298  1.59245161  0.46188424 -1.58011500 -0.88795784
 [13]  1.22434777  0.48474091 -1.47072856 -1.18442250  0.82239570  0.60531211
 [19]  0.94902009 -0.44823933 -0.11775576 -1.23858676 -0.97773834 -0.58248533
 [25]  0.58513668 -0.53468802 -1.79416569 -0.44367819  0.00229523  1.20818859
 [31] -0.45533023  1.95927207 -1.84445397  0.14623416  0.54297482 -0.11681004
 [37] -0.81275850 -0.03151630  0.57870245  0.73160855 -0.14976357 -0.41036093
 [43] -1.23298014  0.10903928  0.88429900 -1.55771742  0.54514511  0.64986515
 [49]  1.33590427 -1.11356412 -0.77329575 -0.44621851 -0.15357186  1.02620367
 [55] -0.91374010  0.43873019 -1.71759339 -0.75989313  1.02339563 -0.20841232
 [61] -0.43896079 -0.78344968  1.20740919 -0.04607262  0.82391345 -0.67141123
 [67]  1.01577147  1.68849785 -0.07974321 -0.35492166 -1.08171485  1.24832806
 [73] -0.35829377 -1.76599355 -1.13462735 -1.70947941  0.41218052 -1.57101956
 [79] -0.11192618 -0.42724843  2.06019322  1.02480260  0.32780336  0.87891359
 [85]  0.76610753 -1.24703139  0.98498148  1.50938844  0.72393762  0.16997147
 [91] -0.02249599 -1.09681608 -0.53919954 -1.18752727 -0.31059653  0.55413902
 [97]  0.64606081 -0.84939404  0.25386204 -0.84006604
> rowMin(tmp2)
  [1] -0.46560987  0.23975554 -0.61830572  0.91609330 -0.80040591  1.17657431
  [7]  0.48093919 -0.42519298  1.59245161  0.46188424 -1.58011500 -0.88795784
 [13]  1.22434777  0.48474091 -1.47072856 -1.18442250  0.82239570  0.60531211
 [19]  0.94902009 -0.44823933 -0.11775576 -1.23858676 -0.97773834 -0.58248533
 [25]  0.58513668 -0.53468802 -1.79416569 -0.44367819  0.00229523  1.20818859
 [31] -0.45533023  1.95927207 -1.84445397  0.14623416  0.54297482 -0.11681004
 [37] -0.81275850 -0.03151630  0.57870245  0.73160855 -0.14976357 -0.41036093
 [43] -1.23298014  0.10903928  0.88429900 -1.55771742  0.54514511  0.64986515
 [49]  1.33590427 -1.11356412 -0.77329575 -0.44621851 -0.15357186  1.02620367
 [55] -0.91374010  0.43873019 -1.71759339 -0.75989313  1.02339563 -0.20841232
 [61] -0.43896079 -0.78344968  1.20740919 -0.04607262  0.82391345 -0.67141123
 [67]  1.01577147  1.68849785 -0.07974321 -0.35492166 -1.08171485  1.24832806
 [73] -0.35829377 -1.76599355 -1.13462735 -1.70947941  0.41218052 -1.57101956
 [79] -0.11192618 -0.42724843  2.06019322  1.02480260  0.32780336  0.87891359
 [85]  0.76610753 -1.24703139  0.98498148  1.50938844  0.72393762  0.16997147
 [91] -0.02249599 -1.09681608 -0.53919954 -1.18752727 -0.31059653  0.55413902
 [97]  0.64606081 -0.84939404  0.25386204 -0.84006604
> 
> colMeans(tmp2)
[1] -0.05879274
> colSums(tmp2)
[1] -5.879274
> colVars(tmp2)
[1] 0.8957806
> colSd(tmp2)
[1] 0.9464569
> colMax(tmp2)
[1] 2.060193
> colMin(tmp2)
[1] -1.844454
> colMedians(tmp2)
[1] -0.1143681
> colRanges(tmp2)
          [,1]
[1,] -1.844454
[2,]  2.060193
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.761904  5.146479  7.113465  1.125775 -2.544602 -1.223829 -2.532255
 [8] -5.345777 -2.547107 -1.500013
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.05698758
[2,] -0.08957999
[3,]  0.31444853
[4,]  0.56274415
[5,]  1.02575549
> 
> rowApply(tmp,sum)
 [1] -7.2219657  2.1580305  5.2473584 -1.4698424  2.1272006 -1.1460509
 [7] -1.2524878 -3.7098448  4.9856975 -0.2640549
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    6    2    8    5    9    7    7    5     2
 [2,]    6    5    8   10   10    1    6    9   10     9
 [3,]   10    7    9    6    6    8    8    8    8     6
 [4,]    7    3   10    9    1    7    3    1    9     8
 [5,]    8    8    5    1    7    2    9    5    1     5
 [6,]    1   10    6    7    8   10    4    2    6     1
 [7,]    9    4    3    2    2    5    2   10    3     3
 [8,]    5    1    7    4    9    6    1    6    2     4
 [9,]    2    2    4    3    4    3   10    3    7    10
[10,]    3    9    1    5    3    4    5    4    4     7
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.7502418  2.4192768 -2.9061500  1.3357405 -0.4488243 -1.2073004
 [7]  3.5254770 -2.9781476  2.4060341 -1.7654050 -3.4109398 -1.5972094
[13] -0.3135781 -0.1794927  1.1921679 -0.3198503  1.2258138  0.4923385
[19] -1.1417031  0.4764422
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.5016458
[2,]  0.3133041
[3,]  0.5230695
[4,]  1.6611234
[5,]  1.7543906
> 
> rowApply(tmp,sum)
[1]  1.2023016 -2.4238269  0.7795760  0.7613707  0.2355106
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   13    9   20   19   13
[2,]    2   18    6   20   14
[3,]    6    4    2   15    3
[4,]   16   17    1   16   11
[5,]    8    8   14    7   18
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,]  0.5230695 -1.2980512 -0.6610022  0.7863466 -0.4582442  0.4640544
[2,] -0.5016458  1.2078607 -1.0725960  0.6192873 -0.5594772  0.1911960
[3,]  1.6611234 -0.3151736 -0.6724687 -0.8668991  0.1682831 -0.5241216
[4,]  1.7543906  2.3155764  0.5865284  0.6025165 -0.5039777 -0.4579697
[5,]  0.3133041  0.5090645 -1.0866115  0.1944892  0.9045917 -0.8804595
            [,7]       [,8]       [,9]       [,10]       [,11]      [,12]
[1,]  0.34120204  0.3891524  1.2147531 -0.70944511  0.57128452  1.0593123
[2,]  1.29255933 -0.7298083  1.3801141 -1.09520024 -1.28482959 -1.3191638
[3,] -0.07993078 -0.4281278  0.4718787 -0.29184419 -0.02097838 -0.1160926
[4,]  1.15644682 -1.4112476 -1.3429617  0.29961350 -1.09302919 -1.3556102
[5,]  0.81519963 -0.7981163  0.6822501  0.03147106 -1.58338718  0.1343447
          [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,] -0.6815056  0.7855866 -0.4973505  0.17988380  0.8433000 -1.42768403
[2,]  0.5879086 -0.6716186  0.3457161  0.06691013 -0.1179397 -0.02052852
[3,]  1.2378001  0.4697008  0.5696470  0.12400437  0.4326406 -0.24559377
[4,]  0.3321913 -0.6475762 -1.0305512 -0.09532848  1.0508169  0.52838350
[5,] -1.7899725 -0.1155853  1.8047065 -0.59532009 -0.9830041  1.65776133
          [,19]      [,20]
[1,] -1.1612491  0.9388883
[2,]  0.1333791 -0.8759507
[3,] -0.5318440 -0.2624275
[4,]  0.1935248 -0.1203662
[5,]  0.2244861  0.7962983
> 
> 
> 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.11-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.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  683  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.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  593  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.11-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 2.730778 -1.088946 0.1496902 1.909212 -0.4096724 1.901271 0.5832291
          col8     col9    col10     col11    col12      col13      col14
row1 0.7239169 1.252821 2.360923 0.3355775 1.044203 -0.6796407 -0.5052712
          col15      col16     col17     col18      col19     col20
row1 -0.5764157 0.06856427 0.4879363 -1.282162 0.01348628 -1.372215
> tmp[,"col10"]
          col10
row1  2.3609229
row2 -0.9441160
row3 -1.0983960
row4 -1.0920458
row5 -0.9761806
> tmp[c("row1","row5"),]
           col1       col2      col3       col4       col5     col6       col7
row1  2.7307779 -1.0889458 0.1496902  1.9092117 -0.4096724 1.901271  0.5832291
row5 -0.4250718  0.5740269 1.2627174 -0.4451043 -0.5696464 0.195074 -1.1959432
          col8      col9      col10     col11    col12      col13      col14
row1 0.7239169  1.252821  2.3609229 0.3355775 1.044203 -0.6796407 -0.5052712
row5 1.2013873 -1.292748 -0.9761806 1.2721018 1.160646 -1.6503841 -0.5575392
          col15      col16     col17     col18       col19      col20
row1 -0.5764157 0.06856427 0.4879363 -1.282162  0.01348628 -1.3722152
row5 -0.8878136 1.46209814 0.2604981  0.478010 -0.25515796  0.4535687
> tmp[,c("col6","col20")]
           col6      col20
row1  1.9012708 -1.3722152
row2  0.3781699  0.5283368
row3 -0.4906299  0.4282270
row4  1.3982380 -0.8253137
row5  0.1950740  0.4535687
> tmp[c("row1","row5"),c("col6","col20")]
         col6      col20
row1 1.901271 -1.3722152
row5 0.195074  0.4535687
> 
> 
> 
> 
> 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.03817 46.66223 50.7012 49.18307 48.31244 105.9474 50.95159 49.38475
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.56143 49.89489 50.02136 50.17179 48.71494 50.19065 50.65567 50.10264
        col17    col18    col19   col20
row1 49.46981 49.59658 50.38893 103.596
> tmp[,"col10"]
        col10
row1 49.89489
row2 30.92500
row3 28.39852
row4 32.38587
row5 49.31307
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.03817 46.66223 50.70120 49.18307 48.31244 105.9474 50.95159 49.38475
row5 50.47870 50.75215 50.17197 51.25143 50.67995 105.4615 51.14890 49.52914
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.56143 49.89489 50.02136 50.17179 48.71494 50.19065 50.65567 50.10264
row5 48.39186 49.31307 49.93998 51.92090 50.87846 51.17407 51.26663 51.24567
        col17    col18    col19    col20
row1 49.46981 49.59658 50.38893 103.5960
row5 50.05863 49.16889 50.79739 104.9381
> tmp[,c("col6","col20")]
          col6     col20
row1 105.94736 103.59596
row2  74.73806  75.86943
row3  74.07331  75.70299
row4  74.06815  75.40956
row5 105.46150 104.93814
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.9474 103.5960
row5 105.4615 104.9381
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.9474 103.5960
row5 105.4615 104.9381
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.92715958
[2,] -0.23885588
[3,]  0.08346401
[4,]  1.04542420
[5,]  0.01632594
> tmp[,c("col17","col7")]
           col17       col7
[1,] -1.03793616 -0.8438679
[2,] -0.03352809  0.4789264
[3,] -1.70618758  2.4817927
[4,] -0.43034038  0.9633697
[5,]  0.76893216  0.4446154
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.03569195  0.5829008
[2,] -0.87746987  1.9686225
[3,]  0.83501522  1.1725071
[4,]  0.67981416  0.4035656
[5,]  1.44631294 -1.9382748
> subBufferedMatrix(tmp,1,c("col6"))[,1]
            col1
[1,] -0.03569195
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.03569195
[2,] -0.87746987
> 
> 
> 
> 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.9472054 -1.194451 -0.4127901 0.9376166 -0.7640078 -1.207962 -1.02648408
row1 0.7762397  1.798670 -2.4462334 0.5436727  0.6999881  2.231042 -0.07868104
           [,8]       [,9]      [,10]      [,11]      [,12]      [,13]
row3 -0.8049847 -1.0364445 -0.3064075 -0.7672590 -0.7429663 -0.4394461
row1  0.6852670 -0.9513485  0.3638562 -0.7542105  0.6460529  1.3101734
         [,14]     [,15]      [,16]     [,17]      [,18]     [,19]      [,20]
row3  2.208741 1.0650673 0.07034308 0.8385673 -1.3712011 0.4403162  0.6740073
row1 -2.278828 0.8115657 1.50975812 0.9329366  0.1828497 0.3826455 -1.5907165
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
            [,1]       [,2]      [,3]     [,4]      [,5]     [,6]      [,7]
row2 -0.08752831 -0.8872365 -1.515342 1.403819 -1.010335 1.088028 0.4719363
       [,8]       [,9]    [,10]
row2 0.2581 -0.6356387 1.624085
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]     [,2]      [,3]      [,4]        [,5]        [,6]       [,7]
row5 -1.42478 0.663142 -0.820376 0.4048061 0.005063644 -0.03291354 -0.3008668
         [,8]       [,9]     [,10]      [,11]    [,12]      [,13]      [,14]
row5 1.104506 -0.3500155 0.0517484 -0.8067425 1.999292 -0.1461955 -0.6120093
         [,15]    [,16]     [,17]      [,18]      [,19]      [,20]
row5 0.9938451 -1.49797 0.4011504 -0.8842046 -0.5246648 -0.2199271
> 
> 
> 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: 0x00000000062ca950>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM17344a8426e4"
 [2] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1734546b1f8c"
 [3] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173435797ee0"
 [4] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173431e7c34" 
 [5] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173443b04cff"
 [6] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM17344151520f"
 [7] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173450dff61" 
 [8] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173415824bcb"
 [9] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM17344d9a5ed7"
[10] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM17345c132679"
[11] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1734196d2b90"
[12] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173411fb734c"
[13] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173443282cf5"
[14] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM173437bc269e"
[15] "C:/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1734237a8d1" 
> 
> 
> ### 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: 0x000000000746c0c8>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x000000000746c0c8>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.11-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x000000000746c0c8>
> rowMedians(tmp)
  [1] -0.0633542753  0.0966544674 -0.1141442326  0.1043887040 -0.7317700506
  [6] -0.2108590929 -0.1976885741 -0.5486240321 -0.2125526430  0.3147094746
 [11] -0.0908073462 -0.3618274821  0.3916677860 -0.2784179886 -0.1709085970
 [16] -0.1332963935 -0.2520601692 -0.0147477205  0.2128963974 -0.0862637246
 [21]  0.3890775022  0.3754461628  0.2261495596 -0.2018779496  0.1828938367
 [26] -0.0048740456 -0.3409119615  0.8366932500  0.0062598547 -0.4109290029
 [31]  0.1924296390  0.3252025509 -0.3575883646  0.3101288199 -0.1762500497
 [36] -0.1705097027  0.0142311427 -0.1680744174  0.0724908113 -0.6074625444
 [41] -0.1460836842 -0.1124873517 -0.9001785579 -0.0918810900  0.2459519099
 [46]  0.4001865955  0.0524555035  0.0957486234 -0.3693904251 -0.3193147190
 [51] -0.3630205933  0.2033614244 -0.2680810629  0.2477679153 -0.6367725239
 [56] -0.1093400998 -0.0034263572  0.0277807251  0.1759400732 -0.0779273551
 [61]  0.2457184737 -0.1956685963  0.3475998086  0.4667184815  0.3111996068
 [66]  0.1262735674 -0.2146793054 -0.0514480243  0.2822316712  0.2361746712
 [71] -0.5663919755 -0.3256491300 -0.1207577639  0.5486656540 -0.1902930654
 [76] -0.1922764340  0.1642341447  0.5711368553 -0.0645157867  0.6811291933
 [81]  0.1626447101 -0.1030972469  0.0755491682  0.4111197652  0.5948699854
 [86] -0.3434971551 -0.0619607063  0.3116068766 -0.3846758778 -0.6245338605
 [91] -0.5931690510  0.2921293550  0.2677598469  0.2589511628 -0.0022636569
 [96] -0.3301690964  0.0745446741  0.1142621564  0.0145557089  0.2531883934
[101]  0.1373180421 -0.1492411391  0.3060134717  0.1386146292  0.2143598133
[106] -0.0675509910  0.0843773733  0.1645954322  0.0974660842  0.0050745330
[111]  0.1576721095  0.0589994772 -0.4080944905  0.2828517473 -0.0527397272
[116]  0.4436031276 -0.2303362542  0.0105841914  0.0769115875  0.4617582035
[121] -0.0375253768 -0.0915987786 -0.5147418915 -0.2223867539 -0.2529451192
[126] -0.3694380227 -0.2894893450 -0.3117669960  0.2169449357 -0.2574706543
[131]  0.5909453848 -0.1164322334 -0.5417494756  0.4511182916 -0.5623098454
[136]  0.2354894652  0.0879634656  0.4334033103 -0.1151275454  0.0252446384
[141] -0.2302990893  0.1187592190 -0.4598132656 -0.1622121373  0.4071796022
[146]  0.0220208360  0.8059144909  0.1278006000  0.2617618909  0.2736352467
[151]  0.5525823278 -0.1824021897  0.2770427766 -0.1227587957 -0.5720053612
[156]  0.2155406749 -0.0358346690 -0.3021764636 -0.2579804027 -0.2056641541
[161] -0.2644969668 -0.3767834336 -0.2448201328  0.1414435287  0.4462992303
[166] -0.4419166339 -0.3180965786 -0.0792942554  0.0625014953 -0.0015549455
[171] -0.1031860056  0.0500511497  0.1117212004  0.0657022469 -0.3804881203
[176] -0.1423195554 -0.0966722718 -0.2132324724 -0.0851567468  0.1997191918
[181]  0.2702289273 -0.1253701404 -0.2933578741  0.1136118626  0.5917251367
[186] -0.1821596397 -0.1942546890  0.1237192559 -0.0694389305 -0.4049119156
[191] -0.4323870667 -0.1822448274 -0.1093920173 -0.4917250128 -0.1474018512
[196]  0.2877720926 -0.0421785501 -0.1533454521  0.2755640692  0.1872473260
[201]  0.1921064489  0.4444216771 -0.1848818483  0.0035407874 -0.4250041759
[206]  0.0489953487 -0.1020545609  0.2570872118  0.4418657838  0.7518540649
[211] -0.1367078026 -0.1898881420 -0.2463660087  0.3573225570 -0.9000302271
[216]  0.1571663194 -0.0088520555  0.1656316911 -0.5553932435  0.0457432105
[221] -0.3599355231 -0.5025131544 -0.0001287115  0.2018904122  0.4007163979
[226] -0.2697676361 -0.1221382916 -0.5555417404 -0.1127992125 -0.1210206522
> 
> proc.time()
   user  system elapsed 
   3.56    8.84   13.23 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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: 0x02dabee8>
> .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: 0x02dabee8>
> .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: 0x02dabee8>
> .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: 0x02dabee8>
> 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: 0x02d84fe8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02d84fe8>
> .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: 0x02d84fe8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02d84fe8>
> .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: 0x02d84fe8>
> 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: 0x02f4b718>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02f4b718>
> .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: 0x02f4b718>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x02f4b718>
> .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: 0x02f4b718>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x02f4b718>
> .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: 0x02f4b718>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x02f4b718>
> .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: 0x02f4b718>
> 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: 0x02f48f80>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x02f48f80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02f48f80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02f48f80>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile20e0258663e3" "BufferedMatrixFile20e03ecb682a"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile20e0258663e3" "BufferedMatrixFile20e03ecb682a"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x01f608c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01f608c0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01f608c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01f608c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x01f608c0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x01f608c0>
> .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: 0x01ee23b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01ee23b0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x01ee23b0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x01ee23b0>
> 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: 0x038be8a8>
> .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: 0x038be8a8>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.48    0.04    0.51 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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: 0x0000000007a86f70>
> .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: 0x0000000007a86f70>
> .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: 0x0000000007a86f70>
> .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: 0x0000000007a86f70>
> 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: 0x000000000799c028>
> .Call("R_bm_AddColumn",P)
<pointer: 0x000000000799c028>
> .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: 0x000000000799c028>
> .Call("R_bm_AddColumn",P)
<pointer: 0x000000000799c028>
> .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: 0x000000000799c028>
> 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: 0x00000000075cb498>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000075cb498>
> .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: 0x00000000075cb498>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000075cb498>
> .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: 0x00000000075cb498>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x00000000075cb498>
> .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: 0x00000000075cb498>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x00000000075cb498>
> .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: 0x00000000075cb498>
> 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: 0x0000000005c04e50>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000005c04e50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005c04e50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005c04e50>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile5a83065180" "BufferedMatrixFile5a8c901161"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile5a83065180" "BufferedMatrixFile5a8c901161"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000079bc118>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000079bc118>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x00000000079bc118>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x00000000079bc118>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x00000000079bc118>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x00000000079bc118>
> .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: 0x000000000541e600>
> .Call("R_bm_AddColumn",P)
<pointer: 0x000000000541e600>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x000000000541e600>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x000000000541e600>
> 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: 0x00000000075f7c38>
> .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: 0x00000000075f7c38>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.40    0.09    0.50 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.53    0.10    0.62 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 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.57    0.09    0.65 

Example timings