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

CHECK report for BufferedMatrix on tokay1

This page was generated on 2020-04-15 12:17:54 -0400 (Wed, 15 Apr 2020).

Package 205/1823HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.50.0
Ben Bolstad
Snapshot Date: 2020-04-14 16:46:13 -0400 (Tue, 14 Apr 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_10
Last Commit: c7a0fa5
Last Changed Date: 2019-10-29 13:07:46 -0400 (Tue, 29 Oct 2019)
malbec1 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay1 Windows Server 2012 R2 Standard / x64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository
merida1 OS X 10.11.6 El Capitan / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.50.0
Command: C:\Users\biocbuild\bbs-3.10-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.10-bioc\R\library --no-vignettes --timings BufferedMatrix_1.50.0.tar.gz
StartedAt: 2020-04-15 01:44:11 -0400 (Wed, 15 Apr 2020)
EndedAt: 2020-04-15 01:45:02 -0400 (Wed, 15 Apr 2020)
EllapsedTime: 51.2 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  202k  100  202k    0     0   836k      0 --:--:-- --:--:-- --:--:--  850k

install for i386

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

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.32    0.06    0.39 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.40    0.03    0.42 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.10-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 407705 12.5     848897   26   631948 19.3
Vcells 463736  3.6    8388608   64  1454007 11.1
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Apr 15 01:44:37 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] "Wed Apr 15 01:44:37 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: 0x02e44360>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Apr 15 01:44:39 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] "Wed Apr 15 01:44:39 2020"
> 
> ColMode(tmp2)
<pointer: 0x02e44360>
> 
> 
> 
> ### 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,] 98.99493288  1.0998843 -1.8916242  0.98972272
[2,]  0.01097625 -0.1997131 -0.4928872 -0.27802314
[3,]  1.53553162 -1.3345334  0.2640656 -0.09875082
[4,]  0.02713748 -0.3847570  0.4105852 -0.85120474
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-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,] 98.99493288 1.0998843 1.8916242 0.98972272
[2,]  0.01097625 0.1997131 0.4928872 0.27802314
[3,]  1.53553162 1.3345334 0.2640656 0.09875082
[4,]  0.02713748 0.3847570 0.4105852 0.85120474
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9496197 1.0487537 1.3753633 0.9948481
[2,] 0.1047676 0.4468928 0.7020592 0.5272790
[3,] 1.2391657 1.1552201 0.5138732 0.3142464
[4,] 0.1647346 0.6202878 0.6407692 0.9226076
> 
> 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.10-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,] 223.49113 36.58742 40.64526 35.93820
[2,]  26.05865 29.66864 32.51348 30.55081
[3,]  38.92719 37.88673 30.40280 28.24122
[4,]  26.67448 31.58764 31.81828 35.07728
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x029b6f38>
> exp(tmp5)
<pointer: 0x029b6f38>
> log(tmp5,2)
<pointer: 0x029b6f38>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.1675
> Min(tmp5)
[1] 52.98685
> mean(tmp5)
[1] 72.23243
> Sum(tmp5)
[1] 14446.49
> Var(tmp5)
[1] 860.9278
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.57426 69.51196 72.95970 69.65542 69.70612 69.14100 72.03337 68.75327
 [9] 67.86284 72.12635
> rowSums(tmp5)
 [1] 1811.485 1390.239 1459.194 1393.108 1394.122 1382.820 1440.667 1375.065
 [9] 1357.257 1442.527
> rowVars(tmp5)
 [1] 7880.62609  105.96707   66.02168   61.07955   92.02936   54.71337
 [7]   65.49012   73.61694   78.66429  119.73855
> rowSd(tmp5)
 [1] 88.772891 10.294031  8.125372  7.815340  9.593194  7.396849  8.092597
 [8]  8.580031  8.869289 10.942511
> rowMax(tmp5)
 [1] 465.16751  91.24037  87.58105  82.42807  90.87986  88.10703  81.56669
 [8]  85.69144  90.38662  92.67952
> rowMin(tmp5)
 [1] 55.36179 54.23767 58.78039 55.51944 57.03592 59.76790 53.96136 56.24217
 [9] 55.06860 52.98685
> 
> colMeans(tmp5)
 [1] 106.36349  67.71173  72.44972  68.67744  69.46042  76.48684  70.71371
 [8]  71.82368  66.56731  71.82609  69.67579  65.91068  70.09502  74.27419
[15]  69.73485  68.21384  73.28770  72.55817  71.16311  67.65479
> colSums(tmp5)
 [1] 1063.6349  677.1173  724.4972  686.7744  694.6042  764.8684  707.1371
 [8]  718.2368  665.6731  718.2609  696.7579  659.1068  700.9502  742.7419
[15]  697.3485  682.1384  732.8770  725.5817  711.6311  676.5479
> colVars(tmp5)
 [1] 15999.33774   111.52973    93.03126    51.31314    61.46137    67.34846
 [7]    58.02475    61.37819    71.13563    67.08402    51.12177    74.28735
[13]    62.76175    94.40845   141.15632    58.33586   120.45468   118.78685
[19]   108.67496    53.87013
> colSd(tmp5)
 [1] 126.488489  10.560764   9.645271   7.163319   7.839730   8.206611
 [7]   7.617398   7.834423   8.434194   8.190483   7.149949   8.619011
[13]   7.922231   9.716401  11.880922   7.637791  10.975185  10.898938
[19]  10.424728   7.339627
> colMax(tmp5)
 [1] 465.16751  90.38662  84.59778  78.15904  80.38538  91.24037  85.69144
 [8]  85.47759  87.58105  83.07573  81.56669  80.02486  84.58202  88.10703
[15]  92.67952  79.13065  90.87986  88.89876  84.93220  78.61077
> colMin(tmp5)
 [1] 54.23767 57.54722 53.96136 57.03592 57.26523 62.07493 59.88414 62.79370
 [9] 59.34590 58.05655 59.78502 56.81455 59.93708 58.16779 55.36179 55.51928
[17] 58.71744 56.24217 52.98685 57.36670
> 
> 
> ### 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.57426 69.51196 72.95970 69.65542 69.70612 69.14100 72.03337 68.75327
 [9] 67.86284       NA
> rowSums(tmp5)
 [1] 1811.485 1390.239 1459.194 1393.108 1394.122 1382.820 1440.667 1375.065
 [9] 1357.257       NA
> rowVars(tmp5)
 [1] 7880.62609  105.96707   66.02168   61.07955   92.02936   54.71337
 [7]   65.49012   73.61694   78.66429  117.62628
> rowSd(tmp5)
 [1] 88.772891 10.294031  8.125372  7.815340  9.593194  7.396849  8.092597
 [8]  8.580031  8.869289 10.845565
> rowMax(tmp5)
 [1] 465.16751  91.24037  87.58105  82.42807  90.87986  88.10703  81.56669
 [8]  85.69144  90.38662        NA
> rowMin(tmp5)
 [1] 55.36179 54.23767 58.78039 55.51944 57.03592 59.76790 53.96136 56.24217
 [9] 55.06860       NA
> 
> colMeans(tmp5)
 [1] 106.36349  67.71173  72.44972  68.67744  69.46042  76.48684        NA
 [8]  71.82368  66.56731  71.82609  69.67579  65.91068  70.09502  74.27419
[15]  69.73485  68.21384  73.28770  72.55817  71.16311  67.65479
> colSums(tmp5)
 [1] 1063.6349  677.1173  724.4972  686.7744  694.6042  764.8684        NA
 [8]  718.2368  665.6731  718.2609  696.7579  659.1068  700.9502  742.7419
[15]  697.3485  682.1384  732.8770  725.5817  711.6311  676.5479
> colVars(tmp5)
 [1] 15999.33774   111.52973    93.03126    51.31314    61.46137    67.34846
 [7]          NA    61.37819    71.13563    67.08402    51.12177    74.28735
[13]    62.76175    94.40845   141.15632    58.33586   120.45468   118.78685
[19]   108.67496    53.87013
> colSd(tmp5)
 [1] 126.488489  10.560764   9.645271   7.163319   7.839730   8.206611
 [7]         NA   7.834423   8.434194   8.190483   7.149949   8.619011
[13]   7.922231   9.716401  11.880922   7.637791  10.975185  10.898938
[19]  10.424728   7.339627
> colMax(tmp5)
 [1] 465.16751  90.38662  84.59778  78.15904  80.38538  91.24037        NA
 [8]  85.47759  87.58105  83.07573  81.56669  80.02486  84.58202  88.10703
[15]  92.67952  79.13065  90.87986  88.89876  84.93220  78.61077
> colMin(tmp5)
 [1] 54.23767 57.54722 53.96136 57.03592 57.26523 62.07493       NA 62.79370
 [9] 59.34590 58.05655 59.78502 56.81455 59.93708 58.16779 55.36179 55.51928
[17] 58.71744 56.24217 52.98685 57.36670
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.1675
> Min(tmp5,na.rm=TRUE)
[1] 52.98685
> mean(tmp5,na.rm=TRUE)
[1] 72.29448
> Sum(tmp5,na.rm=TRUE)
[1] 14386.6
> Var(tmp5,na.rm=TRUE)
[1] 864.5019
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.57426 69.51196 72.95970 69.65542 69.70612 69.14100 72.03337 68.75327
 [9] 67.86284 72.77067
> rowSums(tmp5,na.rm=TRUE)
 [1] 1811.485 1390.239 1459.194 1393.108 1394.122 1382.820 1440.667 1375.065
 [9] 1357.257 1382.643
> rowVars(tmp5,na.rm=TRUE)
 [1] 7880.62609  105.96707   66.02168   61.07955   92.02936   54.71337
 [7]   65.49012   73.61694   78.66429  117.62628
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.772891 10.294031  8.125372  7.815340  9.593194  7.396849  8.092597
 [8]  8.580031  8.869289 10.845565
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.16751  91.24037  87.58105  82.42807  90.87986  88.10703  81.56669
 [8]  85.69144  90.38662  92.67952
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.36179 54.23767 58.78039 55.51944 57.03592 59.76790 53.96136 56.24217
 [9] 55.06860 52.98685
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.36349  67.71173  72.44972  68.67744  69.46042  76.48684  71.91699
 [8]  71.82368  66.56731  71.82609  69.67579  65.91068  70.09502  74.27419
[15]  69.73485  68.21384  73.28770  72.55817  71.16311  67.65479
> colSums(tmp5,na.rm=TRUE)
 [1] 1063.6349  677.1173  724.4972  686.7744  694.6042  764.8684  647.2529
 [8]  718.2368  665.6731  718.2609  696.7579  659.1068  700.9502  742.7419
[15]  697.3485  682.1384  732.8770  725.5817  711.6311  676.5479
> colVars(tmp5,na.rm=TRUE)
 [1] 15999.33774   111.52973    93.03126    51.31314    61.46137    67.34846
 [7]    48.98903    61.37819    71.13563    67.08402    51.12177    74.28735
[13]    62.76175    94.40845   141.15632    58.33586   120.45468   118.78685
[19]   108.67496    53.87013
> colSd(tmp5,na.rm=TRUE)
 [1] 126.488489  10.560764   9.645271   7.163319   7.839730   8.206611
 [7]   6.999216   7.834423   8.434194   8.190483   7.149949   8.619011
[13]   7.922231   9.716401  11.880922   7.637791  10.975185  10.898938
[19]  10.424728   7.339627
> colMax(tmp5,na.rm=TRUE)
 [1] 465.16751  90.38662  84.59778  78.15904  80.38538  91.24037  85.69144
 [8]  85.47759  87.58105  83.07573  81.56669  80.02486  84.58202  88.10703
[15]  92.67952  79.13065  90.87986  88.89876  84.93220  78.61077
> colMin(tmp5,na.rm=TRUE)
 [1] 54.23767 57.54722 53.96136 57.03592 57.26523 62.07493 62.98092 62.79370
 [9] 59.34590 58.05655 59.78502 56.81455 59.93708 58.16779 55.36179 55.51928
[17] 58.71744 56.24217 52.98685 57.36670
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.57426 69.51196 72.95970 69.65542 69.70612 69.14100 72.03337 68.75327
 [9] 67.86284      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1811.485 1390.239 1459.194 1393.108 1394.122 1382.820 1440.667 1375.065
 [9] 1357.257    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 7880.62609  105.96707   66.02168   61.07955   92.02936   54.71337
 [7]   65.49012   73.61694   78.66429         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.772891 10.294031  8.125372  7.815340  9.593194  7.396849  8.092597
 [8]  8.580031  8.869289        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.16751  91.24037  87.58105  82.42807  90.87986  88.10703  81.56669
 [8]  85.69144  90.38662        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.36179 54.23767 58.78039 55.51944 57.03592 59.76790 53.96136 56.24217
 [9] 55.06860       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.45423  68.47826  72.38175  68.10148  68.85017  78.08816       NaN
 [8]  70.30657  66.68347  72.12256  69.74045  66.36817  69.04275  74.33539
[15]  67.18545  67.00086  71.74450  70.74255  73.18270  67.15785
> colSums(tmp5,na.rm=TRUE)
 [1] 1003.0880  616.3044  651.4358  612.9133  619.6515  702.7934    0.0000
 [8]  632.7592  600.1512  649.1030  627.6641  597.3135  621.3847  669.0185
[15]  604.6690  603.0078  645.7005  636.6829  658.6443  604.4206
> colVars(tmp5,na.rm=TRUE)
 [1] 17707.70408   118.86084   104.60819    53.99523    64.95450    46.91937
 [7]          NA    43.15749    79.87578    74.48075    57.46495    81.21871
[13]    58.15023   106.16737    85.68171    49.07552   108.71992    96.54980
[19]    76.37372    57.82572
> colSd(tmp5,na.rm=TRUE)
 [1] 133.070298  10.902332  10.227815   7.348145   8.059435   6.849771
 [7]         NA   6.569436   8.937325   8.630223   7.580564   9.012142
[13]   7.625630  10.303755   9.256441   7.005392  10.426885   9.825976
[19]   8.739206   7.604323
> colMax(tmp5,na.rm=TRUE)
 [1] 465.16751  90.38662  84.59778  78.15904  80.38538  91.24037      -Inf
 [8]  81.20138  87.58105  83.07573  81.56669  80.02486  84.58202  88.10703
[15]  80.87594  77.59726  90.87986  88.13336  84.93220  78.61077
> colMin(tmp5,na.rm=TRUE)
 [1] 54.23767 57.54722 53.96136 57.03592 57.26523 67.56311      Inf 62.79370
 [9] 59.34590 58.05655 59.78502 56.81455 59.93708 58.16779 55.36179 55.51928
[17] 58.71744 56.24217 62.70741 57.36670
> 
> 
> 
> 
> 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] 252.4158 241.1550 445.5421 329.6967 336.9602 142.5977 131.0373 149.2582
 [9] 133.9126 180.7561
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 252.4158 241.1550 445.5421 329.6967 336.9602 142.5977 131.0373 149.2582
 [9] 133.9126 180.7561
> 
> 
> 
> 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] -8.526513e-14  3.979039e-13 -1.421085e-13  5.684342e-14  0.000000e+00
 [6] -5.684342e-14  5.684342e-14 -1.136868e-13 -5.684342e-14 -1.705303e-13
[11]  5.684342e-14 -1.136868e-13  2.842171e-14 -7.105427e-14  5.684342e-14
[16]  1.136868e-13  1.705303e-13  2.842171e-14 -1.705303e-13  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)
+ }
3   18 
4   14 
5   4 
4   3 
4   2 
4   7 
10   14 
6   9 
3   20 
2   14 
8   6 
2   15 
3   5 
2   8 
10   7 
2   3 
1   20 
3   11 
5   7 
7   3 
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.135621
> Min(tmp)
[1] -2.160954
> mean(tmp)
[1] -0.002170002
> Sum(tmp)
[1] -0.2170002
> Var(tmp)
[1] 0.8272617
> 
> rowMeans(tmp)
[1] -0.002170002
> rowSums(tmp)
[1] -0.2170002
> rowVars(tmp)
[1] 0.8272617
> rowSd(tmp)
[1] 0.9095393
> rowMax(tmp)
[1] 2.135621
> rowMin(tmp)
[1] -2.160954
> 
> colMeans(tmp)
  [1]  0.47736760 -0.70314633 -0.52442045  0.31544600  0.63341256  1.94960942
  [7] -0.58785104  0.11841478 -0.96918586  0.40568558 -1.36626828  0.91540155
 [13] -0.23075084 -0.68636222  0.79895983 -0.92907177 -0.47462242 -0.12893972
 [19]  0.03935164 -1.43658404  0.50162863  0.73838371  0.97386231 -0.01489085
 [25]  0.34626361 -1.18737708 -0.87917393 -0.60467380 -1.34045050 -0.18928004
 [31] -0.25358115  1.46969606 -0.82791815 -0.37588602  0.54226458  0.83931908
 [37] -0.19743243  1.53011774  0.74786664  0.65606112 -0.46548772 -0.64769423
 [43]  0.15699202 -1.11755468 -0.05065338 -0.85574841  1.20736715  2.13562135
 [49]  0.35032298 -0.88139780 -0.70443290 -0.04803729  1.56350277  0.98007685
 [55]  2.10613860 -1.19631845  0.64364841 -0.67000623  0.46967655  0.32080368
 [61] -0.83952060 -0.47371488 -1.49455430  0.72238163 -0.21866760 -1.15713743
 [67] -0.46886512 -0.04402469 -0.45860031  0.50948802  0.29375098 -1.86927524
 [73]  0.99735260 -0.79840677  1.18929906  0.37070077  2.06738969 -0.07458534
 [79] -0.34450390 -1.38665544  0.36013761 -0.61179827  0.32985747 -0.73163458
 [85] -2.16095371  0.58080885  0.20083899  1.49274300  0.90919650  0.22934703
 [91] -0.46363356  0.41198449  0.71432770  0.11269112 -0.64801785  1.54373577
 [97] -0.90697861 -0.70209237 -0.85466492  0.06718928
> colSums(tmp)
  [1]  0.47736760 -0.70314633 -0.52442045  0.31544600  0.63341256  1.94960942
  [7] -0.58785104  0.11841478 -0.96918586  0.40568558 -1.36626828  0.91540155
 [13] -0.23075084 -0.68636222  0.79895983 -0.92907177 -0.47462242 -0.12893972
 [19]  0.03935164 -1.43658404  0.50162863  0.73838371  0.97386231 -0.01489085
 [25]  0.34626361 -1.18737708 -0.87917393 -0.60467380 -1.34045050 -0.18928004
 [31] -0.25358115  1.46969606 -0.82791815 -0.37588602  0.54226458  0.83931908
 [37] -0.19743243  1.53011774  0.74786664  0.65606112 -0.46548772 -0.64769423
 [43]  0.15699202 -1.11755468 -0.05065338 -0.85574841  1.20736715  2.13562135
 [49]  0.35032298 -0.88139780 -0.70443290 -0.04803729  1.56350277  0.98007685
 [55]  2.10613860 -1.19631845  0.64364841 -0.67000623  0.46967655  0.32080368
 [61] -0.83952060 -0.47371488 -1.49455430  0.72238163 -0.21866760 -1.15713743
 [67] -0.46886512 -0.04402469 -0.45860031  0.50948802  0.29375098 -1.86927524
 [73]  0.99735260 -0.79840677  1.18929906  0.37070077  2.06738969 -0.07458534
 [79] -0.34450390 -1.38665544  0.36013761 -0.61179827  0.32985747 -0.73163458
 [85] -2.16095371  0.58080885  0.20083899  1.49274300  0.90919650  0.22934703
 [91] -0.46363356  0.41198449  0.71432770  0.11269112 -0.64801785  1.54373577
 [97] -0.90697861 -0.70209237 -0.85466492  0.06718928
> 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.47736760 -0.70314633 -0.52442045  0.31544600  0.63341256  1.94960942
  [7] -0.58785104  0.11841478 -0.96918586  0.40568558 -1.36626828  0.91540155
 [13] -0.23075084 -0.68636222  0.79895983 -0.92907177 -0.47462242 -0.12893972
 [19]  0.03935164 -1.43658404  0.50162863  0.73838371  0.97386231 -0.01489085
 [25]  0.34626361 -1.18737708 -0.87917393 -0.60467380 -1.34045050 -0.18928004
 [31] -0.25358115  1.46969606 -0.82791815 -0.37588602  0.54226458  0.83931908
 [37] -0.19743243  1.53011774  0.74786664  0.65606112 -0.46548772 -0.64769423
 [43]  0.15699202 -1.11755468 -0.05065338 -0.85574841  1.20736715  2.13562135
 [49]  0.35032298 -0.88139780 -0.70443290 -0.04803729  1.56350277  0.98007685
 [55]  2.10613860 -1.19631845  0.64364841 -0.67000623  0.46967655  0.32080368
 [61] -0.83952060 -0.47371488 -1.49455430  0.72238163 -0.21866760 -1.15713743
 [67] -0.46886512 -0.04402469 -0.45860031  0.50948802  0.29375098 -1.86927524
 [73]  0.99735260 -0.79840677  1.18929906  0.37070077  2.06738969 -0.07458534
 [79] -0.34450390 -1.38665544  0.36013761 -0.61179827  0.32985747 -0.73163458
 [85] -2.16095371  0.58080885  0.20083899  1.49274300  0.90919650  0.22934703
 [91] -0.46363356  0.41198449  0.71432770  0.11269112 -0.64801785  1.54373577
 [97] -0.90697861 -0.70209237 -0.85466492  0.06718928
> colMin(tmp)
  [1]  0.47736760 -0.70314633 -0.52442045  0.31544600  0.63341256  1.94960942
  [7] -0.58785104  0.11841478 -0.96918586  0.40568558 -1.36626828  0.91540155
 [13] -0.23075084 -0.68636222  0.79895983 -0.92907177 -0.47462242 -0.12893972
 [19]  0.03935164 -1.43658404  0.50162863  0.73838371  0.97386231 -0.01489085
 [25]  0.34626361 -1.18737708 -0.87917393 -0.60467380 -1.34045050 -0.18928004
 [31] -0.25358115  1.46969606 -0.82791815 -0.37588602  0.54226458  0.83931908
 [37] -0.19743243  1.53011774  0.74786664  0.65606112 -0.46548772 -0.64769423
 [43]  0.15699202 -1.11755468 -0.05065338 -0.85574841  1.20736715  2.13562135
 [49]  0.35032298 -0.88139780 -0.70443290 -0.04803729  1.56350277  0.98007685
 [55]  2.10613860 -1.19631845  0.64364841 -0.67000623  0.46967655  0.32080368
 [61] -0.83952060 -0.47371488 -1.49455430  0.72238163 -0.21866760 -1.15713743
 [67] -0.46886512 -0.04402469 -0.45860031  0.50948802  0.29375098 -1.86927524
 [73]  0.99735260 -0.79840677  1.18929906  0.37070077  2.06738969 -0.07458534
 [79] -0.34450390 -1.38665544  0.36013761 -0.61179827  0.32985747 -0.73163458
 [85] -2.16095371  0.58080885  0.20083899  1.49274300  0.90919650  0.22934703
 [91] -0.46363356  0.41198449  0.71432770  0.11269112 -0.64801785  1.54373577
 [97] -0.90697861 -0.70209237 -0.85466492  0.06718928
> colMedians(tmp)
  [1]  0.47736760 -0.70314633 -0.52442045  0.31544600  0.63341256  1.94960942
  [7] -0.58785104  0.11841478 -0.96918586  0.40568558 -1.36626828  0.91540155
 [13] -0.23075084 -0.68636222  0.79895983 -0.92907177 -0.47462242 -0.12893972
 [19]  0.03935164 -1.43658404  0.50162863  0.73838371  0.97386231 -0.01489085
 [25]  0.34626361 -1.18737708 -0.87917393 -0.60467380 -1.34045050 -0.18928004
 [31] -0.25358115  1.46969606 -0.82791815 -0.37588602  0.54226458  0.83931908
 [37] -0.19743243  1.53011774  0.74786664  0.65606112 -0.46548772 -0.64769423
 [43]  0.15699202 -1.11755468 -0.05065338 -0.85574841  1.20736715  2.13562135
 [49]  0.35032298 -0.88139780 -0.70443290 -0.04803729  1.56350277  0.98007685
 [55]  2.10613860 -1.19631845  0.64364841 -0.67000623  0.46967655  0.32080368
 [61] -0.83952060 -0.47371488 -1.49455430  0.72238163 -0.21866760 -1.15713743
 [67] -0.46886512 -0.04402469 -0.45860031  0.50948802  0.29375098 -1.86927524
 [73]  0.99735260 -0.79840677  1.18929906  0.37070077  2.06738969 -0.07458534
 [79] -0.34450390 -1.38665544  0.36013761 -0.61179827  0.32985747 -0.73163458
 [85] -2.16095371  0.58080885  0.20083899  1.49274300  0.90919650  0.22934703
 [91] -0.46363356  0.41198449  0.71432770  0.11269112 -0.64801785  1.54373577
 [97] -0.90697861 -0.70209237 -0.85466492  0.06718928
> colRanges(tmp)
          [,1]       [,2]       [,3]     [,4]      [,5]     [,6]      [,7]
[1,] 0.4773676 -0.7031463 -0.5244204 0.315446 0.6334126 1.949609 -0.587851
[2,] 0.4773676 -0.7031463 -0.5244204 0.315446 0.6334126 1.949609 -0.587851
          [,8]       [,9]     [,10]     [,11]     [,12]      [,13]      [,14]
[1,] 0.1184148 -0.9691859 0.4056856 -1.366268 0.9154016 -0.2307508 -0.6863622
[2,] 0.1184148 -0.9691859 0.4056856 -1.366268 0.9154016 -0.2307508 -0.6863622
         [,15]      [,16]      [,17]      [,18]      [,19]     [,20]     [,21]
[1,] 0.7989598 -0.9290718 -0.4746224 -0.1289397 0.03935164 -1.436584 0.5016286
[2,] 0.7989598 -0.9290718 -0.4746224 -0.1289397 0.03935164 -1.436584 0.5016286
         [,22]     [,23]       [,24]     [,25]     [,26]      [,27]      [,28]
[1,] 0.7383837 0.9738623 -0.01489085 0.3462636 -1.187377 -0.8791739 -0.6046738
[2,] 0.7383837 0.9738623 -0.01489085 0.3462636 -1.187377 -0.8791739 -0.6046738
         [,29]    [,30]      [,31]    [,32]      [,33]     [,34]     [,35]
[1,] -1.340451 -0.18928 -0.2535811 1.469696 -0.8279182 -0.375886 0.5422646
[2,] -1.340451 -0.18928 -0.2535811 1.469696 -0.8279182 -0.375886 0.5422646
         [,36]      [,37]    [,38]     [,39]     [,40]      [,41]      [,42]
[1,] 0.8393191 -0.1974324 1.530118 0.7478666 0.6560611 -0.4654877 -0.6476942
[2,] 0.8393191 -0.1974324 1.530118 0.7478666 0.6560611 -0.4654877 -0.6476942
        [,43]     [,44]       [,45]      [,46]    [,47]    [,48]    [,49]
[1,] 0.156992 -1.117555 -0.05065338 -0.8557484 1.207367 2.135621 0.350323
[2,] 0.156992 -1.117555 -0.05065338 -0.8557484 1.207367 2.135621 0.350323
          [,50]      [,51]       [,52]    [,53]     [,54]    [,55]     [,56]
[1,] -0.8813978 -0.7044329 -0.04803729 1.563503 0.9800768 2.106139 -1.196318
[2,] -0.8813978 -0.7044329 -0.04803729 1.563503 0.9800768 2.106139 -1.196318
         [,57]      [,58]     [,59]     [,60]      [,61]      [,62]     [,63]
[1,] 0.6436484 -0.6700062 0.4696766 0.3208037 -0.8395206 -0.4737149 -1.494554
[2,] 0.6436484 -0.6700062 0.4696766 0.3208037 -0.8395206 -0.4737149 -1.494554
         [,64]      [,65]     [,66]      [,67]       [,68]      [,69]    [,70]
[1,] 0.7223816 -0.2186676 -1.157137 -0.4688651 -0.04402469 -0.4586003 0.509488
[2,] 0.7223816 -0.2186676 -1.157137 -0.4688651 -0.04402469 -0.4586003 0.509488
        [,71]     [,72]     [,73]      [,74]    [,75]     [,76]   [,77]
[1,] 0.293751 -1.869275 0.9973526 -0.7984068 1.189299 0.3707008 2.06739
[2,] 0.293751 -1.869275 0.9973526 -0.7984068 1.189299 0.3707008 2.06739
           [,78]      [,79]     [,80]     [,81]      [,82]     [,83]      [,84]
[1,] -0.07458534 -0.3445039 -1.386655 0.3601376 -0.6117983 0.3298575 -0.7316346
[2,] -0.07458534 -0.3445039 -1.386655 0.3601376 -0.6117983 0.3298575 -0.7316346
         [,85]     [,86]    [,87]    [,88]     [,89]    [,90]      [,91]
[1,] -2.160954 0.5808089 0.200839 1.492743 0.9091965 0.229347 -0.4636336
[2,] -2.160954 0.5808089 0.200839 1.492743 0.9091965 0.229347 -0.4636336
         [,92]     [,93]     [,94]      [,95]    [,96]      [,97]      [,98]
[1,] 0.4119845 0.7143277 0.1126911 -0.6480178 1.543736 -0.9069786 -0.7020924
[2,] 0.4119845 0.7143277 0.1126911 -0.6480178 1.543736 -0.9069786 -0.7020924
          [,99]     [,100]
[1,] -0.8546649 0.06718928
[2,] -0.8546649 0.06718928
> 
> 
> Max(tmp2)
[1] 1.924187
> Min(tmp2)
[1] -2.721942
> mean(tmp2)
[1] -0.1246906
> Sum(tmp2)
[1] -12.46906
> Var(tmp2)
[1] 0.9330681
> 
> rowMeans(tmp2)
  [1] -1.738297570 -0.335178199  0.485093238 -0.675266911 -0.813829512
  [6]  0.118056473 -1.275147414  0.977873149 -0.070191072 -0.270408513
 [11]  1.125273112 -1.440125428 -0.791833026  0.980152382 -0.083028007
 [16]  0.395356488  0.604567599  0.710761663  1.055525268 -1.723526350
 [21] -0.133555207  1.377507294  0.146226527  0.576175897 -0.054101573
 [26] -1.010587282  1.015921235 -0.706760751 -0.939954819 -2.707374817
 [31]  0.169965800 -0.241786682 -0.172211473  0.962366502 -1.649553415
 [36] -2.721941829  0.464558041 -0.114280617  1.214497621 -1.291069068
 [41] -2.369751260 -0.942416769  0.960945809  0.523369852  1.321141804
 [46]  0.064881442 -1.028152936 -0.160004463  0.542545069 -0.152303844
 [51] -0.703415545 -0.274934821 -0.439634478  1.218036836 -0.761796239
 [56] -1.500338134  0.634258115  0.511411419  0.758834897  0.806682410
 [61] -1.655811474  0.461690314 -1.319470683  0.795085844  0.014211910
 [66]  1.255073072  0.494137696 -0.434703347 -1.010532421  1.389153712
 [71]  0.206870134 -0.876365943  0.392212736  0.843600612  0.409356317
 [76] -1.124606485  0.523373330  1.924187424 -0.293090864 -0.454377818
 [81] -0.596349096  0.052445357  0.003819416 -0.880697552  0.581634511
 [86] -0.125313608 -1.952633805  0.450086423 -1.101622399  0.695619148
 [91]  0.764111657  0.347831329  0.091357256 -0.889910159 -1.360543069
 [96]  0.125121162  0.675450302  0.498305131 -0.306257614 -1.510735174
> rowSums(tmp2)
  [1] -1.738297570 -0.335178199  0.485093238 -0.675266911 -0.813829512
  [6]  0.118056473 -1.275147414  0.977873149 -0.070191072 -0.270408513
 [11]  1.125273112 -1.440125428 -0.791833026  0.980152382 -0.083028007
 [16]  0.395356488  0.604567599  0.710761663  1.055525268 -1.723526350
 [21] -0.133555207  1.377507294  0.146226527  0.576175897 -0.054101573
 [26] -1.010587282  1.015921235 -0.706760751 -0.939954819 -2.707374817
 [31]  0.169965800 -0.241786682 -0.172211473  0.962366502 -1.649553415
 [36] -2.721941829  0.464558041 -0.114280617  1.214497621 -1.291069068
 [41] -2.369751260 -0.942416769  0.960945809  0.523369852  1.321141804
 [46]  0.064881442 -1.028152936 -0.160004463  0.542545069 -0.152303844
 [51] -0.703415545 -0.274934821 -0.439634478  1.218036836 -0.761796239
 [56] -1.500338134  0.634258115  0.511411419  0.758834897  0.806682410
 [61] -1.655811474  0.461690314 -1.319470683  0.795085844  0.014211910
 [66]  1.255073072  0.494137696 -0.434703347 -1.010532421  1.389153712
 [71]  0.206870134 -0.876365943  0.392212736  0.843600612  0.409356317
 [76] -1.124606485  0.523373330  1.924187424 -0.293090864 -0.454377818
 [81] -0.596349096  0.052445357  0.003819416 -0.880697552  0.581634511
 [86] -0.125313608 -1.952633805  0.450086423 -1.101622399  0.695619148
 [91]  0.764111657  0.347831329  0.091357256 -0.889910159 -1.360543069
 [96]  0.125121162  0.675450302  0.498305131 -0.306257614 -1.510735174
> 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.738297570 -0.335178199  0.485093238 -0.675266911 -0.813829512
  [6]  0.118056473 -1.275147414  0.977873149 -0.070191072 -0.270408513
 [11]  1.125273112 -1.440125428 -0.791833026  0.980152382 -0.083028007
 [16]  0.395356488  0.604567599  0.710761663  1.055525268 -1.723526350
 [21] -0.133555207  1.377507294  0.146226527  0.576175897 -0.054101573
 [26] -1.010587282  1.015921235 -0.706760751 -0.939954819 -2.707374817
 [31]  0.169965800 -0.241786682 -0.172211473  0.962366502 -1.649553415
 [36] -2.721941829  0.464558041 -0.114280617  1.214497621 -1.291069068
 [41] -2.369751260 -0.942416769  0.960945809  0.523369852  1.321141804
 [46]  0.064881442 -1.028152936 -0.160004463  0.542545069 -0.152303844
 [51] -0.703415545 -0.274934821 -0.439634478  1.218036836 -0.761796239
 [56] -1.500338134  0.634258115  0.511411419  0.758834897  0.806682410
 [61] -1.655811474  0.461690314 -1.319470683  0.795085844  0.014211910
 [66]  1.255073072  0.494137696 -0.434703347 -1.010532421  1.389153712
 [71]  0.206870134 -0.876365943  0.392212736  0.843600612  0.409356317
 [76] -1.124606485  0.523373330  1.924187424 -0.293090864 -0.454377818
 [81] -0.596349096  0.052445357  0.003819416 -0.880697552  0.581634511
 [86] -0.125313608 -1.952633805  0.450086423 -1.101622399  0.695619148
 [91]  0.764111657  0.347831329  0.091357256 -0.889910159 -1.360543069
 [96]  0.125121162  0.675450302  0.498305131 -0.306257614 -1.510735174
> rowMin(tmp2)
  [1] -1.738297570 -0.335178199  0.485093238 -0.675266911 -0.813829512
  [6]  0.118056473 -1.275147414  0.977873149 -0.070191072 -0.270408513
 [11]  1.125273112 -1.440125428 -0.791833026  0.980152382 -0.083028007
 [16]  0.395356488  0.604567599  0.710761663  1.055525268 -1.723526350
 [21] -0.133555207  1.377507294  0.146226527  0.576175897 -0.054101573
 [26] -1.010587282  1.015921235 -0.706760751 -0.939954819 -2.707374817
 [31]  0.169965800 -0.241786682 -0.172211473  0.962366502 -1.649553415
 [36] -2.721941829  0.464558041 -0.114280617  1.214497621 -1.291069068
 [41] -2.369751260 -0.942416769  0.960945809  0.523369852  1.321141804
 [46]  0.064881442 -1.028152936 -0.160004463  0.542545069 -0.152303844
 [51] -0.703415545 -0.274934821 -0.439634478  1.218036836 -0.761796239
 [56] -1.500338134  0.634258115  0.511411419  0.758834897  0.806682410
 [61] -1.655811474  0.461690314 -1.319470683  0.795085844  0.014211910
 [66]  1.255073072  0.494137696 -0.434703347 -1.010532421  1.389153712
 [71]  0.206870134 -0.876365943  0.392212736  0.843600612  0.409356317
 [76] -1.124606485  0.523373330  1.924187424 -0.293090864 -0.454377818
 [81] -0.596349096  0.052445357  0.003819416 -0.880697552  0.581634511
 [86] -0.125313608 -1.952633805  0.450086423 -1.101622399  0.695619148
 [91]  0.764111657  0.347831329  0.091357256 -0.889910159 -1.360543069
 [96]  0.125121162  0.675450302  0.498305131 -0.306257614 -1.510735174
> 
> colMeans(tmp2)
[1] -0.1246906
> colSums(tmp2)
[1] -12.46906
> colVars(tmp2)
[1] 0.9330681
> colSd(tmp2)
[1] 0.9659545
> colMax(tmp2)
[1] 1.924187
> colMin(tmp2)
[1] -2.721942
> colMedians(tmp2)
[1] -0.02514108
> colRanges(tmp2)
          [,1]
[1,] -2.721942
[2,]  1.924187
> 
> 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.467098  3.292754  4.697668  2.211417  2.281349  2.701482  1.680629
 [8]  5.685798 -2.139783  1.587564
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.82015102
[2,] -0.92723666
[3,]  0.09520897
[4,]  0.33467340
[5,]  1.39524370
> 
> rowApply(tmp,sum)
 [1]  2.7229641  2.5413919  0.4805351  2.1147595  4.1742887  3.5326379
 [7]  1.0967699  3.8003982 -2.1827570  2.2507923
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    2    6    5    2    9    2    5    1     5
 [2,]    2    9    8    1    8    4    1   10    4     9
 [3,]    1    3   10    9    7    3   10    9    6     1
 [4,]    7    8    1   10    9    6    4    1    5     8
 [5,]   10    7    3    6    4    8    6    7    3     4
 [6,]    3   10    7    4    3    2    8    2    7    10
 [7,]    6    5    4    3    5    7    9    8    2     3
 [8,]    8    4    2    7   10   10    5    3    8     6
 [9,]    4    1    5    2    1    5    3    6    9     7
[10,]    5    6    9    8    6    1    7    4   10     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.35715129  0.70748537 -1.53885181  1.88033199 -2.02900503 -0.28257896
 [7] -0.05357554  0.94774186 -3.31962830 -0.17498686  0.33473580 -4.83978477
[13] -4.19515872  0.48458799  1.91403101  1.03456151  0.67770578 -0.03166782
[19] -1.18749140 -2.24574344
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.4175641
[2,]  0.2238247
[3,]  0.5242176
[4,]  0.6017962
[5,]  1.4248769
> 
> rowApply(tmp,sum)
[1] -4.118983 -1.212595 -2.801426  1.134577 -2.561714
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17   20   11   15    6
[2,]    7   14   17   10   15
[3,]   19    3    5   14    4
[4,]   20   10   16    7   12
[5,]    2   16    8    3    8
> 
> 
> as.matrix(tmp)
           [,1]         [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  0.6017962 -0.503836266  1.0292151  1.81392309 -1.4365621 -0.6378857
[2,]  1.4248769  0.364600670 -0.8506429 -0.24629323  0.6779706 -0.2873158
[3,]  0.2238247  0.744572843 -1.0071109  0.68464180 -0.1442773  0.4009669
[4,]  0.5242176 -0.003995218  0.3856465 -0.38596699 -0.7934080  0.5955987
[5,] -0.4175641  0.106143344 -1.0959597  0.01402732 -0.3327282 -0.3539431
            [,7]       [,8]      [,9]      [,10]      [,11]      [,12]
[1,] -0.47219624  0.2143480 -1.186628 -0.3505101 -0.5007453 -1.0371639
[2,] -0.30072663  0.9029283 -1.426059  0.3026624 -0.4307337 -0.2415681
[3,]  0.35114187 -0.7368464  1.118367  0.3858977  0.4539375 -2.5464676
[4,]  0.30640090  0.6991731 -1.556211  0.6723821  0.1108321 -0.8918362
[5,]  0.06180457 -0.1318611 -0.269097 -1.1854190  0.7014453 -0.1227488
          [,13]      [,14]       [,15]       [,16]       [,17]      [,18]
[1,] -1.6642454  0.6178436 -1.19105252  0.05923911  0.03125285  0.5047243
[2,] -1.6553076  0.4965582  0.72895095  0.80289930 -0.50830385 -0.2355789
[3,] -1.4690881  0.8690835  1.22282206  0.18330605  0.07489729 -0.5121006
[4,] -0.7398035 -0.6903058 -0.07231548 -0.09219488  2.27596092 -0.7891960
[5,]  1.3332859 -0.8085914  1.22562599  0.08131192 -1.19610142  1.0004834
            [,19]       [,20]
[1,]  0.005621965 -0.01612178
[2,] -0.247366687 -0.48414532
[3,] -1.349054690 -1.74993899
[4,]  0.056535185  1.52306288
[5,]  0.346772830 -1.51860022
> 
> 
> 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.10-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.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  639  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.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  550  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-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.5387224 1.490015 0.1976047 0.4550839 0.8584827 1.430357 1.861909
           col8     col9     col10     col11       col12      col13     col14
row1 0.02422767 1.323789 -1.033208 0.1485432 -0.08836496 -0.5514128 -1.783312
          col15    col16     col17     col18     col19     col20
row1 -0.1437131 1.206511 0.6720322 0.7935979 0.1547584 0.3591186
> tmp[,"col10"]
          col10
row1 -1.0332085
row2 -0.6225583
row3 -1.0373239
row4  0.3698028
row5 -0.9224764
> tmp[c("row1","row5"),]
           col1     col2       col3       col4       col5      col6       col7
row1 -0.5387224 1.490015  0.1976047  0.4550839  0.8584827 1.4303572  1.8619095
row5  0.2771007 0.348464 -0.1493599 -0.1850742 -1.4305724 0.6722151 -0.9475341
            col8      col9      col10     col11       col12      col13
row1  0.02422767 1.3237889 -1.0332085 0.1485432 -0.08836496 -0.5514128
row5 -0.51491441 0.8002637 -0.9224764 0.7976127 -0.88275308 -1.4118874
          col14      col15    col16     col17      col18      col19      col20
row1 -1.7833118 -0.1437131 1.206511 0.6720322 0.79359790 0.15475840  0.3591186
row5 -0.7911232 -1.4857559 1.109247 0.6444241 0.05913673 0.05187961 -1.2549390
> tmp[,c("col6","col20")]
           col6      col20
row1  1.4303572  0.3591186
row2 -0.2962496  0.5810508
row3 -0.7096937  0.3987330
row4  0.9585361  1.5337078
row5  0.6722151 -1.2549390
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 1.4303572  0.3591186
row5 0.6722151 -1.2549390
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.38642 49.46779 49.23264 48.39607 48.95111 106.3599 52.77584 49.12837
         col9    col10    col11    col12    col13   col14   col15   col16
row1 50.39126 49.70275 50.52887 50.58954 50.47725 48.8502 49.5927 49.4082
        col17    col18    col19    col20
row1 48.65763 49.84467 49.16733 104.9699
> tmp[,"col10"]
        col10
row1 49.70275
row2 29.72344
row3 29.83229
row4 29.70163
row5 51.52700
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.38642 49.46779 49.23264 48.39607 48.95111 106.3599 52.77584 49.12837
row5 49.21226 50.16851 49.28296 50.45863 49.12867 104.8830 51.24807 49.03355
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.39126 49.70275 50.52887 50.58954 50.47725 48.85020 49.59270 49.40820
row5 49.66072 51.52700 50.17532 51.62761 51.17018 50.58672 50.76328 50.16111
        col17    col18    col19    col20
row1 48.65763 49.84467 49.16733 104.9699
row5 48.68778 49.54730 50.82067 104.9567
> tmp[,c("col6","col20")]
          col6     col20
row1 106.35987 104.96993
row2  74.52811  74.61485
row3  74.36961  75.64592
row4  76.88562  74.14890
row5 104.88296 104.95669
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.3599 104.9699
row5 104.8830 104.9567
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.3599 104.9699
row5 104.8830 104.9567
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.3756349
[2,] -0.3082311
[3,]  0.5410510
[4,]  1.1345573
[5,]  0.5422039
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.9314580 -2.2039437
[2,] -0.4300918  0.2331709
[3,] -1.5096990 -0.4113982
[4,]  0.9843455  1.0513689
[5,]  0.1133128 -0.2693115
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.8881729  0.1226949
[2,]  1.9806650 -0.7211598
[3,] -0.7173054 -0.5225916
[4,] -1.4121033 -0.2283347
[5,]  0.7946954  0.4698591
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.8881729
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.8881729
[2,] 1.9806650
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]       [,4]       [,5]        [,6]
row3  0.4185524 -1.520893 -0.3061985  0.1215989 0.08636223  0.01511035
row1 -0.2266337 -1.321734  1.1128717 -0.6773445 0.45465292 -0.86769237
          [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
row3 -1.972580  0.3485289 -0.22333824 -0.6368208 -1.5955402  0.6447133
row1  1.581118 -0.5961485  0.02509949 -1.1381047 -0.3467369 -0.7129896
           [,13]      [,14]       [,15]      [,16]     [,17]     [,18]
row3  0.09544286 -1.3274894  0.97460418  0.0412825 1.3842968 0.8007601
row1 -0.32310646  0.4098304 -0.01143957 -0.9798550 0.4739665 1.2385248
          [,19]      [,20]
row3 -0.6124766  1.6560540
row1 -1.2303990 -0.8601404
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
        [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row2 -1.3658 0.2266522 0.8300281 0.0536519 -1.757097 0.2567962 0.6024191
           [,8]      [,9]     [,10]
row2 0.07593519 0.8709846 0.4290317
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]     [,2]      [,3]     [,4]      [,5]     [,6]       [,7]
row5 -1.20469 1.288578 0.1427191 1.397306 -1.762116 1.261457 -0.3817961
          [,8]      [,9]     [,10]     [,11]     [,12]     [,13]      [,14]
row5 0.0736297 0.9596973 0.2989863 0.1881306 -1.136585 -1.012172 -0.4585289
        [,15]    [,16]      [,17]      [,18]   [,19]    [,20]
row5 1.393934 2.111623 0.07141428 -0.9257952 1.09414 2.188522
> 
> 
> 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: 0x034df3b0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1370d422380" 
 [2] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM13703d4e6b2b"
 [3] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM13707ea3afc" 
 [4] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1370395852ce"
 [5] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137038c14b48"
 [6] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1370797e6aa5"
 [7] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM13708ea6512" 
 [8] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137091a1cd8" 
 [9] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137045d118e2"
[10] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM13706a115c5f"
[11] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137023311095"
[12] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1370259e3a18"
[13] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137068b33d0c"
[14] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM13705a515017"
[15] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM137010123c25"
> 
> 
> ### 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: 0x035f8f18>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x035f8f18>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.10-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x035f8f18>
> rowMedians(tmp)
  [1] -0.194324542  0.262277821  0.027836422 -0.477649146  0.083326371
  [6]  0.108892943  0.085804135 -0.589827447 -0.532613468  0.167024657
 [11] -0.327782085 -0.708010010 -0.104552337 -0.191250515  0.090284286
 [16] -0.189144044 -0.499750205  0.330309381 -0.152848298  0.457643777
 [21]  0.150342329 -0.268575096 -0.172624394  0.526188431 -0.428729204
 [26] -0.032533315 -0.157672025  0.244001618 -0.272712225 -0.315772093
 [31]  0.407430579  0.209740611 -0.545698186 -0.457230609  0.168471734
 [36]  0.019997464 -0.470047002 -0.037883603 -0.151043403 -0.147815267
 [41] -0.092504302  0.158544241 -0.534141972 -0.336244433 -0.692415135
 [46] -0.292120674  0.466035224  0.357522550 -0.022673744 -0.066007107
 [51] -0.125092993  0.504782497 -0.360916149  0.017392009  0.333820183
 [56]  0.345639697  0.614775125  0.386070428 -0.292885824  0.165650428
 [61]  0.166377483  0.121304693 -0.123819851  0.507102982  0.161633812
 [66]  0.244072152 -0.356678312 -0.132964696 -0.315844180 -0.613922977
 [71] -0.116762992 -0.209680375 -0.028278180 -0.257769680  0.087720576
 [76] -0.402969054 -0.381462948 -0.367433442 -0.162149562 -0.427917045
 [81]  0.004561175  0.331142172 -0.127220526 -0.173920595  0.005098911
 [86]  0.617955657  0.158820563  0.490472157  0.318300282 -0.191159609
 [91]  0.003642331  0.021532903 -0.150373352  0.078838336  0.463882602
 [96]  0.019712717  0.289306791 -0.207509302 -0.561891223  0.308455990
[101] -0.528108440 -0.121581224 -0.043431797 -0.315139012  0.165079539
[106] -0.342927170 -0.620021641 -0.377272621  0.668584873 -0.508283790
[111] -0.277771372  0.487061891 -0.184845783 -0.074668455 -0.466810797
[116] -0.082382499 -0.372427663  0.014655061  0.327766647  0.058297255
[121] -0.247823848  0.073098490  0.165480862  0.010432030 -0.202406455
[126] -0.310731328  0.198832082 -0.694310000  0.355951022  0.227837296
[131] -0.221547492 -0.011789714 -0.265495236 -0.222326210  0.047565116
[136] -0.044198495 -0.020518389  0.430670454  0.003397252 -0.096170877
[141]  0.131568380 -0.462300486  0.082311156 -0.312049706  0.116903336
[146] -0.346022757 -0.452847847  0.404332085  0.044692420  0.268902209
[151]  0.260992925  0.409659146 -0.014414011 -0.729126600 -0.341318699
[156] -0.096244557 -0.776857975  0.008455482 -0.447461657  0.468511056
[161] -0.131880803 -0.729933827 -0.141130176 -0.427232577  0.167147485
[166]  0.275489032 -0.085425772  0.130286515 -0.064260105 -0.535843460
[171] -0.732144618  0.635473656 -0.286697236  0.278128983  0.498113370
[176] -0.105397782 -0.035399260  0.115500226  0.590435301  0.376296606
[181]  0.228791941 -0.213436119  0.206616639  0.249763567 -0.254007543
[186] -0.313476900 -0.053750470 -0.213589028 -0.117659380  0.010318425
[191]  0.083224847 -0.330527264 -0.221702117  0.046764432  0.325843552
[196]  0.060102460  0.050148590  0.314632491  0.085539460  0.180055120
[201]  0.101564142 -0.409652577 -0.065395095  0.256712350  0.351589757
[206]  0.188692058  0.276073965 -0.053353314  0.198881174  0.099129618
[211] -0.115500183  0.244489426 -0.953116958 -0.600822484  0.181051018
[216]  0.601962335 -0.608021058  0.184741941 -0.371059690  0.207012630
[221] -0.282667165 -0.170739897  0.419023334  0.124219633  0.085493538
[226] -0.052154096 -0.207585269  0.038830472  0.103393596 -0.053588965
> 
> proc.time()
   user  system elapsed 
   2.51    5.53    8.20 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.10-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 407706 21.8     848900 45.4   631948 33.8
Vcells 702675  5.4    8388608 64.0  1654061 12.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Apr 15 01:44:47 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] "Wed Apr 15 01:44:47 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: 0x00000000052513d8>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Apr 15 01:44:49 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] "Wed Apr 15 01:44:50 2020"
> 
> ColMode(tmp2)
<pointer: 0x00000000052513d8>
> 
> 
> 
> ### 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.3154318 -0.4847591 -1.0154669 -0.63458153
[2,]   0.2665363 -1.4367694 -2.3947566  0.09206839
[3,]   1.7617662 -1.6328784  0.8983751  0.67193796
[4,]  -1.7772421  1.1246363  1.7699745 -0.40349627
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-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,] 100.3154318 0.4847591 1.0154669 0.63458153
[2,]   0.2665363 1.4367694 2.3947566 0.09206839
[3,]   1.7617662 1.6328784 0.8983751 0.67193796
[4,]   1.7772421 1.1246363 1.7699745 0.40349627
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-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,] 10.0157592 0.6962465 1.0077038 0.7966063
[2,]  0.5162715 1.1986531 1.5475001 0.3034277
[3,]  1.3273154 1.2778413 0.9478265 0.8197182
[4,]  1.3331325 1.0604887 1.3304039 0.6352136
> 
> 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.10-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,] 225.47302 32.44722 36.09250 33.60064
[2,]  30.42925 38.42330 42.86976 28.12635
[3,]  40.03492 39.41129 35.37664 33.86912
[4,]  40.10857 36.72952 40.07401 31.75563
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000007840980>
> exp(tmp5)
<pointer: 0x0000000007840980>
> log(tmp5,2)
<pointer: 0x0000000007840980>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.2926
> Min(tmp5)
[1] 52.35304
> mean(tmp5)
[1] 73.51119
> Sum(tmp5)
[1] 14702.24
> Var(tmp5)
[1] 857.1944
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.31384 69.26160 72.15375 72.47321 72.91550 70.69149 72.32030 73.88853
 [9] 71.71298 70.38068
> rowSums(tmp5)
 [1] 1786.277 1385.232 1443.075 1449.464 1458.310 1413.830 1446.406 1477.771
 [9] 1434.260 1407.614
> rowVars(tmp5)
 [1] 8066.66079   89.44874   44.51821   51.08445   59.59017   65.03998
 [7]   75.66491   48.27755   97.37954   71.26382
> rowSd(tmp5)
 [1] 89.814591  9.457734  6.672197  7.147339  7.719467  8.064737  8.698558
 [8]  6.948205  9.868107  8.441790
> rowMax(tmp5)
 [1] 469.29256  89.22778  83.32744  83.48073  86.58863  84.14798  89.40918
 [8]  85.75166  85.06803  85.92481
> rowMin(tmp5)
 [1] 57.90080 55.00643 60.18096 60.08047 55.44932 56.23429 58.57019 57.69371
 [9] 52.35304 55.41419
> 
> colMeans(tmp5)
 [1] 113.26337  72.70586  72.27735  69.35390  69.53090  73.44709  69.90825
 [8]  73.68518  65.08073  74.43114  73.35049  75.17175  75.45821  70.28109
[15]  75.12389  73.00662  67.04240  69.15634  70.67533  67.27388
> colSums(tmp5)
 [1] 1132.6337  727.0586  722.7735  693.5390  695.3090  734.4709  699.0825
 [8]  736.8518  650.8073  744.3114  733.5049  751.7175  754.5821  702.8109
[15]  751.2389  730.0662  670.4240  691.5634  706.7533  672.7388
> colVars(tmp5)
 [1] 15696.13415    45.80406   115.14147    57.61484    50.54680    94.48939
 [7]    43.39491    54.29337    62.13878    45.39286    92.05185    77.12307
[13]    54.68892    44.14420    84.06930   114.38666    73.53042    33.36686
[19]    44.17936    39.82255
> colSd(tmp5)
 [1] 125.284213   6.767870  10.730399   7.590444   7.109627   9.720565
 [7]   6.587481   7.368404   7.882815   6.737422   9.594366   8.781974
[13]   7.395196   6.644110   9.168931  10.695170   8.574988   5.776405
[19]   6.646756   6.310511
> colMax(tmp5)
 [1] 469.29256  82.02944  89.22778  80.30864  77.22652  84.14798  78.49495
 [8]  83.19479  81.60244  82.32760  88.68324  86.58863  89.40918  79.86372
[15]  85.06803  86.76307  80.60968  76.54408  80.27610  78.18509
> colMin(tmp5)
 [1] 63.33450 58.72630 57.48309 58.54130 56.23429 52.35304 58.57019 62.36521
 [9] 55.41419 62.63715 55.44932 63.10857 63.48483 63.61085 56.88271 60.18096
[17] 56.71278 59.63099 57.69371 55.00643
> 
> 
> ### 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]       NA 69.26160 72.15375 72.47321 72.91550 70.69149 72.32030 73.88853
 [9] 71.71298 70.38068
> rowSums(tmp5)
 [1]       NA 1385.232 1443.075 1449.464 1458.310 1413.830 1446.406 1477.771
 [9] 1434.260 1407.614
> rowVars(tmp5)
 [1] 8492.84800   89.44874   44.51821   51.08445   59.59017   65.03998
 [7]   75.66491   48.27755   97.37954   71.26382
> rowSd(tmp5)
 [1] 92.156649  9.457734  6.672197  7.147339  7.719467  8.064737  8.698558
 [8]  6.948205  9.868107  8.441790
> rowMax(tmp5)
 [1]       NA 89.22778 83.32744 83.48073 86.58863 84.14798 89.40918 85.75166
 [9] 85.06803 85.92481
> rowMin(tmp5)
 [1]       NA 55.00643 60.18096 60.08047 55.44932 56.23429 58.57019 57.69371
 [9] 52.35304 55.41419
> 
> colMeans(tmp5)
 [1] 113.26337  72.70586  72.27735        NA  69.53090  73.44709  69.90825
 [8]  73.68518  65.08073  74.43114  73.35049  75.17175  75.45821  70.28109
[15]  75.12389  73.00662  67.04240  69.15634  70.67533  67.27388
> colSums(tmp5)
 [1] 1132.6337  727.0586  722.7735        NA  695.3090  734.4709  699.0825
 [8]  736.8518  650.8073  744.3114  733.5049  751.7175  754.5821  702.8109
[15]  751.2389  730.0662  670.4240  691.5634  706.7533  672.7388
> colVars(tmp5)
 [1] 15696.13415    45.80406   115.14147          NA    50.54680    94.48939
 [7]    43.39491    54.29337    62.13878    45.39286    92.05185    77.12307
[13]    54.68892    44.14420    84.06930   114.38666    73.53042    33.36686
[19]    44.17936    39.82255
> colSd(tmp5)
 [1] 125.284213   6.767870  10.730399         NA   7.109627   9.720565
 [7]   6.587481   7.368404   7.882815   6.737422   9.594366   8.781974
[13]   7.395196   6.644110   9.168931  10.695170   8.574988   5.776405
[19]   6.646756   6.310511
> colMax(tmp5)
 [1] 469.29256  82.02944  89.22778        NA  77.22652  84.14798  78.49495
 [8]  83.19479  81.60244  82.32760  88.68324  86.58863  89.40918  79.86372
[15]  85.06803  86.76307  80.60968  76.54408  80.27610  78.18509
> colMin(tmp5)
 [1] 63.33450 58.72630 57.48309       NA 56.23429 52.35304 58.57019 62.36521
 [9] 55.41419 62.63715 55.44932 63.10857 63.48483 63.61085 56.88271 60.18096
[17] 56.71278 59.63099 57.69371 55.00643
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.2926
> Min(tmp5,na.rm=TRUE)
[1] 52.35304
> mean(tmp5,na.rm=TRUE)
[1] 73.52916
> Sum(tmp5,na.rm=TRUE)
[1] 14632.3
> Var(tmp5,na.rm=TRUE)
[1] 861.4588
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.33376 69.26160 72.15375 72.47321 72.91550 70.69149 72.32030 73.88853
 [9] 71.71298 70.38068
> rowSums(tmp5,na.rm=TRUE)
 [1] 1716.342 1385.232 1443.075 1449.464 1458.310 1413.830 1446.406 1477.771
 [9] 1434.260 1407.614
> rowVars(tmp5,na.rm=TRUE)
 [1] 8492.84800   89.44874   44.51821   51.08445   59.59017   65.03998
 [7]   75.66491   48.27755   97.37954   71.26382
> rowSd(tmp5,na.rm=TRUE)
 [1] 92.156649  9.457734  6.672197  7.147339  7.719467  8.064737  8.698558
 [8]  6.948205  9.868107  8.441790
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.29256  89.22778  83.32744  83.48073  86.58863  84.14798  89.40918
 [8]  85.75166  85.06803  85.92481
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.90080 55.00643 60.18096 60.08047 55.44932 56.23429 58.57019 57.69371
 [9] 52.35304 55.41419
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.26337  72.70586  72.27735  69.28929  69.53090  73.44709  69.90825
 [8]  73.68518  65.08073  74.43114  73.35049  75.17175  75.45821  70.28109
[15]  75.12389  73.00662  67.04240  69.15634  70.67533  67.27388
> colSums(tmp5,na.rm=TRUE)
 [1] 1132.6337  727.0586  722.7735  623.6036  695.3090  734.4709  699.0825
 [8]  736.8518  650.8073  744.3114  733.5049  751.7175  754.5821  702.8109
[15]  751.2389  730.0662  670.4240  691.5634  706.7533  672.7388
> colVars(tmp5,na.rm=TRUE)
 [1] 15696.13415    45.80406   115.14147    64.76975    50.54680    94.48939
 [7]    43.39491    54.29337    62.13878    45.39286    92.05185    77.12307
[13]    54.68892    44.14420    84.06930   114.38666    73.53042    33.36686
[19]    44.17936    39.82255
> colSd(tmp5,na.rm=TRUE)
 [1] 125.284213   6.767870  10.730399   8.047965   7.109627   9.720565
 [7]   6.587481   7.368404   7.882815   6.737422   9.594366   8.781974
[13]   7.395196   6.644110   9.168931  10.695170   8.574988   5.776405
[19]   6.646756   6.310511
> colMax(tmp5,na.rm=TRUE)
 [1] 469.29256  82.02944  89.22778  80.30864  77.22652  84.14798  78.49495
 [8]  83.19479  81.60244  82.32760  88.68324  86.58863  89.40918  79.86372
[15]  85.06803  86.76307  80.60968  76.54408  80.27610  78.18509
> colMin(tmp5,na.rm=TRUE)
 [1] 63.33450 58.72630 57.48309 58.54130 56.23429 52.35304 58.57019 62.36521
 [9] 55.41419 62.63715 55.44932 63.10857 63.48483 63.61085 56.88271 60.18096
[17] 56.71278 59.63099 57.69371 55.00643
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 69.26160 72.15375 72.47321 72.91550 70.69149 72.32030 73.88853
 [9] 71.71298 70.38068
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1385.232 1443.075 1449.464 1458.310 1413.830 1446.406 1477.771
 [9] 1434.260 1407.614
> rowVars(tmp5,na.rm=TRUE)
 [1]       NA 89.44874 44.51821 51.08445 59.59017 65.03998 75.66491 48.27755
 [9] 97.37954 71.26382
> rowSd(tmp5,na.rm=TRUE)
 [1]       NA 9.457734 6.672197 7.147339 7.719467 8.064737 8.698558 6.948205
 [9] 9.868107 8.441790
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 89.22778 83.32744 83.48073 86.58863 84.14798 89.40918 85.75166
 [9] 85.06803 85.92481
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 55.00643 60.18096 60.08047 55.44932 56.23429 58.57019 57.69371
 [9] 52.35304 55.41419
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 73.70458 73.28044 71.96130      NaN 70.42093 72.74900 70.55395 74.94295
 [9] 65.87850 74.05527 74.17485 75.68001 75.47122 70.88555 74.21164 71.47812
[17] 67.95364 70.21471 70.63153 67.56928
> colSums(tmp5,na.rm=TRUE)
 [1] 663.3412 659.5240 647.6517   0.0000 633.7883 654.7410 634.9855 674.4866
 [9] 592.9065 666.4974 667.5736 681.1201 679.2410 637.9699 667.9047 643.3031
[17] 611.5828 631.9324 635.6838 608.1235
> colVars(tmp5,na.rm=TRUE)
 [1]  53.04267  47.81547 128.41041        NA  47.95346 100.81799  44.12879
 [8]  43.28258  62.74620  49.47761  95.91321  83.85733  61.52313  45.55184
[15]  85.21568 102.40167  73.38015  24.93603  49.68020  43.81870
> colSd(tmp5,na.rm=TRUE)
 [1]  7.283040  6.914873 11.331832        NA  6.924844 10.040816  6.642950
 [8]  6.578950  7.921250  7.034032  9.793529  9.157365  7.843668  6.749210
[15]  9.231234 10.119371  8.566222  4.993599  7.048419  6.619570
> colMax(tmp5,na.rm=TRUE)
 [1] 83.48073 82.02944 89.22778     -Inf 77.22652 84.14798 78.49495 83.19479
 [9] 81.60244 82.32760 88.68324 86.58863 89.40918 79.86372 85.06803 85.92481
[17] 80.60968 76.54408 80.27610 78.18509
> colMin(tmp5,na.rm=TRUE)
 [1] 63.33450 58.72630 57.48309      Inf 56.23429 52.35304 58.57019 64.87623
 [9] 55.41419 62.63715 55.44932 63.10857 63.48483 63.61085 56.88271 60.18096
[17] 56.71278 62.00212 57.69371 55.00643
> 
> 
> 
> 
> 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] 166.7368 142.5909 209.7491 117.9707 230.8507 179.3970 264.9516 224.0158
 [9] 261.5984 146.0940
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 166.7368 142.5909 209.7491 117.9707 230.8507 179.3970 264.9516 224.0158
 [9] 261.5984 146.0940
> 
> 
> 
> 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.421085e-13  0.000000e+00  0.000000e+00 -8.526513e-14  0.000000e+00
 [6]  1.136868e-13 -5.684342e-14 -1.705303e-13 -5.684342e-14  0.000000e+00
[11]  0.000000e+00 -1.136868e-13 -5.684342e-14  5.684342e-14  2.557954e-13
[16]  1.136868e-13  1.989520e-13  2.842171e-14  5.684342e-14  2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
9   17 
5   15 
9   12 
3   2 
8   2 
9   19 
5   17 
2   16 
2   10 
1   14 
7   10 
6   19 
4   4 
3   14 
2   8 
8   11 
5   11 
5   4 
10   9 
2   19 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.140662
> Min(tmp)
[1] -2.240285
> mean(tmp)
[1] 0.09684089
> Sum(tmp)
[1] 9.684089
> Var(tmp)
[1] 1.151514
> 
> rowMeans(tmp)
[1] 0.09684089
> rowSums(tmp)
[1] 9.684089
> rowVars(tmp)
[1] 1.151514
> rowSd(tmp)
[1] 1.073086
> rowMax(tmp)
[1] 3.140662
> rowMin(tmp)
[1] -2.240285
> 
> colMeans(tmp)
  [1]  0.816377361 -0.004935786  0.655333824  1.781335622 -0.765896366
  [6] -1.144484990 -0.844288740  1.756171535 -1.820861623  1.850918676
 [11]  0.230805891 -1.218834082  0.904887897  0.058246081  0.754516503
 [16] -0.550353351 -0.450657313  0.589912334  0.107477133 -0.059180220
 [21] -0.596863116  1.010564685 -0.657952504 -0.371944059  0.570064307
 [26] -1.066297390  0.334931280 -2.240284558  1.598895123  1.547329028
 [31]  0.134165969  1.057922214 -0.950460224 -0.343989573 -0.651502277
 [36]  1.980503010 -0.564224504  1.194003481 -1.547731745  2.033711238
 [41]  0.619490219  1.520989391 -1.049512200 -0.515811722  1.576378627
 [46]  0.347202916  2.182149922  0.099396830  0.913267520  1.067738223
 [51]  0.139867275 -1.063359018 -0.163237642  0.140846882  0.539327041
 [56]  1.390246320 -1.728122997 -0.524934514 -1.104462359 -0.169930041
 [61] -1.317557398  0.152058151 -1.098260852 -0.464513018 -0.712484836
 [66] -1.647577796  1.076060025 -0.134578183 -1.744277028 -1.244092577
 [71]  1.003914986 -1.817037967 -0.207256320  1.683401883  1.133123671
 [76]  0.988665118  0.388661089  0.335710256  0.431647302  0.820500489
 [81]  0.719367466  0.645435179 -0.262064827  0.098932476 -0.159996445
 [86] -0.978573031 -0.784227093 -0.756201178  0.978426007 -0.526866173
 [91] -1.359584457  1.260828221 -1.178304488  0.864277637  0.686396068
 [96]  1.172637624 -0.181844736 -0.576902324  3.140661668 -0.079276836
> colSums(tmp)
  [1]  0.816377361 -0.004935786  0.655333824  1.781335622 -0.765896366
  [6] -1.144484990 -0.844288740  1.756171535 -1.820861623  1.850918676
 [11]  0.230805891 -1.218834082  0.904887897  0.058246081  0.754516503
 [16] -0.550353351 -0.450657313  0.589912334  0.107477133 -0.059180220
 [21] -0.596863116  1.010564685 -0.657952504 -0.371944059  0.570064307
 [26] -1.066297390  0.334931280 -2.240284558  1.598895123  1.547329028
 [31]  0.134165969  1.057922214 -0.950460224 -0.343989573 -0.651502277
 [36]  1.980503010 -0.564224504  1.194003481 -1.547731745  2.033711238
 [41]  0.619490219  1.520989391 -1.049512200 -0.515811722  1.576378627
 [46]  0.347202916  2.182149922  0.099396830  0.913267520  1.067738223
 [51]  0.139867275 -1.063359018 -0.163237642  0.140846882  0.539327041
 [56]  1.390246320 -1.728122997 -0.524934514 -1.104462359 -0.169930041
 [61] -1.317557398  0.152058151 -1.098260852 -0.464513018 -0.712484836
 [66] -1.647577796  1.076060025 -0.134578183 -1.744277028 -1.244092577
 [71]  1.003914986 -1.817037967 -0.207256320  1.683401883  1.133123671
 [76]  0.988665118  0.388661089  0.335710256  0.431647302  0.820500489
 [81]  0.719367466  0.645435179 -0.262064827  0.098932476 -0.159996445
 [86] -0.978573031 -0.784227093 -0.756201178  0.978426007 -0.526866173
 [91] -1.359584457  1.260828221 -1.178304488  0.864277637  0.686396068
 [96]  1.172637624 -0.181844736 -0.576902324  3.140661668 -0.079276836
> 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.816377361 -0.004935786  0.655333824  1.781335622 -0.765896366
  [6] -1.144484990 -0.844288740  1.756171535 -1.820861623  1.850918676
 [11]  0.230805891 -1.218834082  0.904887897  0.058246081  0.754516503
 [16] -0.550353351 -0.450657313  0.589912334  0.107477133 -0.059180220
 [21] -0.596863116  1.010564685 -0.657952504 -0.371944059  0.570064307
 [26] -1.066297390  0.334931280 -2.240284558  1.598895123  1.547329028
 [31]  0.134165969  1.057922214 -0.950460224 -0.343989573 -0.651502277
 [36]  1.980503010 -0.564224504  1.194003481 -1.547731745  2.033711238
 [41]  0.619490219  1.520989391 -1.049512200 -0.515811722  1.576378627
 [46]  0.347202916  2.182149922  0.099396830  0.913267520  1.067738223
 [51]  0.139867275 -1.063359018 -0.163237642  0.140846882  0.539327041
 [56]  1.390246320 -1.728122997 -0.524934514 -1.104462359 -0.169930041
 [61] -1.317557398  0.152058151 -1.098260852 -0.464513018 -0.712484836
 [66] -1.647577796  1.076060025 -0.134578183 -1.744277028 -1.244092577
 [71]  1.003914986 -1.817037967 -0.207256320  1.683401883  1.133123671
 [76]  0.988665118  0.388661089  0.335710256  0.431647302  0.820500489
 [81]  0.719367466  0.645435179 -0.262064827  0.098932476 -0.159996445
 [86] -0.978573031 -0.784227093 -0.756201178  0.978426007 -0.526866173
 [91] -1.359584457  1.260828221 -1.178304488  0.864277637  0.686396068
 [96]  1.172637624 -0.181844736 -0.576902324  3.140661668 -0.079276836
> colMin(tmp)
  [1]  0.816377361 -0.004935786  0.655333824  1.781335622 -0.765896366
  [6] -1.144484990 -0.844288740  1.756171535 -1.820861623  1.850918676
 [11]  0.230805891 -1.218834082  0.904887897  0.058246081  0.754516503
 [16] -0.550353351 -0.450657313  0.589912334  0.107477133 -0.059180220
 [21] -0.596863116  1.010564685 -0.657952504 -0.371944059  0.570064307
 [26] -1.066297390  0.334931280 -2.240284558  1.598895123  1.547329028
 [31]  0.134165969  1.057922214 -0.950460224 -0.343989573 -0.651502277
 [36]  1.980503010 -0.564224504  1.194003481 -1.547731745  2.033711238
 [41]  0.619490219  1.520989391 -1.049512200 -0.515811722  1.576378627
 [46]  0.347202916  2.182149922  0.099396830  0.913267520  1.067738223
 [51]  0.139867275 -1.063359018 -0.163237642  0.140846882  0.539327041
 [56]  1.390246320 -1.728122997 -0.524934514 -1.104462359 -0.169930041
 [61] -1.317557398  0.152058151 -1.098260852 -0.464513018 -0.712484836
 [66] -1.647577796  1.076060025 -0.134578183 -1.744277028 -1.244092577
 [71]  1.003914986 -1.817037967 -0.207256320  1.683401883  1.133123671
 [76]  0.988665118  0.388661089  0.335710256  0.431647302  0.820500489
 [81]  0.719367466  0.645435179 -0.262064827  0.098932476 -0.159996445
 [86] -0.978573031 -0.784227093 -0.756201178  0.978426007 -0.526866173
 [91] -1.359584457  1.260828221 -1.178304488  0.864277637  0.686396068
 [96]  1.172637624 -0.181844736 -0.576902324  3.140661668 -0.079276836
> colMedians(tmp)
  [1]  0.816377361 -0.004935786  0.655333824  1.781335622 -0.765896366
  [6] -1.144484990 -0.844288740  1.756171535 -1.820861623  1.850918676
 [11]  0.230805891 -1.218834082  0.904887897  0.058246081  0.754516503
 [16] -0.550353351 -0.450657313  0.589912334  0.107477133 -0.059180220
 [21] -0.596863116  1.010564685 -0.657952504 -0.371944059  0.570064307
 [26] -1.066297390  0.334931280 -2.240284558  1.598895123  1.547329028
 [31]  0.134165969  1.057922214 -0.950460224 -0.343989573 -0.651502277
 [36]  1.980503010 -0.564224504  1.194003481 -1.547731745  2.033711238
 [41]  0.619490219  1.520989391 -1.049512200 -0.515811722  1.576378627
 [46]  0.347202916  2.182149922  0.099396830  0.913267520  1.067738223
 [51]  0.139867275 -1.063359018 -0.163237642  0.140846882  0.539327041
 [56]  1.390246320 -1.728122997 -0.524934514 -1.104462359 -0.169930041
 [61] -1.317557398  0.152058151 -1.098260852 -0.464513018 -0.712484836
 [66] -1.647577796  1.076060025 -0.134578183 -1.744277028 -1.244092577
 [71]  1.003914986 -1.817037967 -0.207256320  1.683401883  1.133123671
 [76]  0.988665118  0.388661089  0.335710256  0.431647302  0.820500489
 [81]  0.719367466  0.645435179 -0.262064827  0.098932476 -0.159996445
 [86] -0.978573031 -0.784227093 -0.756201178  0.978426007 -0.526866173
 [91] -1.359584457  1.260828221 -1.178304488  0.864277637  0.686396068
 [96]  1.172637624 -0.181844736 -0.576902324  3.140661668 -0.079276836
> colRanges(tmp)
          [,1]         [,2]      [,3]     [,4]       [,5]      [,6]       [,7]
[1,] 0.8163774 -0.004935786 0.6553338 1.781336 -0.7658964 -1.144485 -0.8442887
[2,] 0.8163774 -0.004935786 0.6553338 1.781336 -0.7658964 -1.144485 -0.8442887
         [,8]      [,9]    [,10]     [,11]     [,12]     [,13]      [,14]
[1,] 1.756172 -1.820862 1.850919 0.2308059 -1.218834 0.9048879 0.05824608
[2,] 1.756172 -1.820862 1.850919 0.2308059 -1.218834 0.9048879 0.05824608
         [,15]      [,16]      [,17]     [,18]     [,19]       [,20]      [,21]
[1,] 0.7545165 -0.5503534 -0.4506573 0.5899123 0.1074771 -0.05918022 -0.5968631
[2,] 0.7545165 -0.5503534 -0.4506573 0.5899123 0.1074771 -0.05918022 -0.5968631
        [,22]      [,23]      [,24]     [,25]     [,26]     [,27]     [,28]
[1,] 1.010565 -0.6579525 -0.3719441 0.5700643 -1.066297 0.3349313 -2.240285
[2,] 1.010565 -0.6579525 -0.3719441 0.5700643 -1.066297 0.3349313 -2.240285
        [,29]    [,30]    [,31]    [,32]      [,33]      [,34]      [,35]
[1,] 1.598895 1.547329 0.134166 1.057922 -0.9504602 -0.3439896 -0.6515023
[2,] 1.598895 1.547329 0.134166 1.057922 -0.9504602 -0.3439896 -0.6515023
        [,36]      [,37]    [,38]     [,39]    [,40]     [,41]    [,42]
[1,] 1.980503 -0.5642245 1.194003 -1.547732 2.033711 0.6194902 1.520989
[2,] 1.980503 -0.5642245 1.194003 -1.547732 2.033711 0.6194902 1.520989
         [,43]      [,44]    [,45]     [,46]   [,47]      [,48]     [,49]
[1,] -1.049512 -0.5158117 1.576379 0.3472029 2.18215 0.09939683 0.9132675
[2,] -1.049512 -0.5158117 1.576379 0.3472029 2.18215 0.09939683 0.9132675
        [,50]     [,51]     [,52]      [,53]     [,54]    [,55]    [,56]
[1,] 1.067738 0.1398673 -1.063359 -0.1632376 0.1408469 0.539327 1.390246
[2,] 1.067738 0.1398673 -1.063359 -0.1632376 0.1408469 0.539327 1.390246
         [,57]      [,58]     [,59]    [,60]     [,61]     [,62]     [,63]
[1,] -1.728123 -0.5249345 -1.104462 -0.16993 -1.317557 0.1520582 -1.098261
[2,] -1.728123 -0.5249345 -1.104462 -0.16993 -1.317557 0.1520582 -1.098261
         [,64]      [,65]     [,66]   [,67]      [,68]     [,69]     [,70]
[1,] -0.464513 -0.7124848 -1.647578 1.07606 -0.1345782 -1.744277 -1.244093
[2,] -0.464513 -0.7124848 -1.647578 1.07606 -0.1345782 -1.744277 -1.244093
        [,71]     [,72]      [,73]    [,74]    [,75]     [,76]     [,77]
[1,] 1.003915 -1.817038 -0.2072563 1.683402 1.133124 0.9886651 0.3886611
[2,] 1.003915 -1.817038 -0.2072563 1.683402 1.133124 0.9886651 0.3886611
         [,78]     [,79]     [,80]     [,81]     [,82]      [,83]      [,84]
[1,] 0.3357103 0.4316473 0.8205005 0.7193675 0.6454352 -0.2620648 0.09893248
[2,] 0.3357103 0.4316473 0.8205005 0.7193675 0.6454352 -0.2620648 0.09893248
          [,85]     [,86]      [,87]      [,88]    [,89]      [,90]     [,91]
[1,] -0.1599964 -0.978573 -0.7842271 -0.7562012 0.978426 -0.5268662 -1.359584
[2,] -0.1599964 -0.978573 -0.7842271 -0.7562012 0.978426 -0.5268662 -1.359584
        [,92]     [,93]     [,94]     [,95]    [,96]      [,97]      [,98]
[1,] 1.260828 -1.178304 0.8642776 0.6863961 1.172638 -0.1818447 -0.5769023
[2,] 1.260828 -1.178304 0.8642776 0.6863961 1.172638 -0.1818447 -0.5769023
        [,99]      [,100]
[1,] 3.140662 -0.07927684
[2,] 3.140662 -0.07927684
> 
> 
> Max(tmp2)
[1] 2.619972
> Min(tmp2)
[1] -2.296548
> mean(tmp2)
[1] -0.02481071
> Sum(tmp2)
[1] -2.481071
> Var(tmp2)
[1] 1.020214
> 
> rowMeans(tmp2)
  [1]  0.191081618 -0.051548918  1.291366365 -1.669481252 -0.444617073
  [6]  1.351185340  2.619972069  0.446253076 -1.203857484 -0.108777493
 [11]  1.392096814 -1.983055042  1.374554802  0.845573921 -1.995480011
 [16]  0.290683796  0.851137908 -0.173909165 -0.677269594 -1.803116816
 [21] -0.818186249  1.796377216 -0.139089101 -0.479522104 -0.463418425
 [26]  0.093570882 -1.037539613 -1.565751455 -1.638141699 -0.102360516
 [31]  0.515627914  0.677693520  0.144680772  0.505407868  0.310489594
 [36] -1.855315901  1.786314454  0.249252647 -0.272056965 -0.066043178
 [41]  1.215544128 -0.054110588  1.505818936 -0.169031626  0.027419230
 [46] -0.533267639 -1.181409861 -1.885787833 -0.047131910 -0.091316283
 [51] -1.215064675 -2.080630856 -0.829585644 -0.258606831 -1.401558680
 [56]  0.814345638  0.728409581  1.535453941 -0.349082618 -1.542476938
 [61] -1.546997082  1.121158808  1.260204295 -0.394948859  0.316790683
 [66]  0.921039367  1.064595964  0.258249740  0.514063300 -1.087099595
 [71]  0.692103946 -0.512519323  0.687562917 -1.006400307 -2.296548494
 [76]  1.058761270  0.171764889 -0.045231139  0.307732410  0.456921343
 [81]  0.420700210  0.518668515 -0.001283587 -0.212555048  0.832912819
 [86] -0.309765213  1.629862009 -0.203749206  0.396223360  0.069005209
 [91]  1.684735099  0.370001401  0.184327327 -0.044534260 -0.513975958
 [96] -0.570739598 -0.937886801  0.089899276 -0.519997646  0.323164883
> rowSums(tmp2)
  [1]  0.191081618 -0.051548918  1.291366365 -1.669481252 -0.444617073
  [6]  1.351185340  2.619972069  0.446253076 -1.203857484 -0.108777493
 [11]  1.392096814 -1.983055042  1.374554802  0.845573921 -1.995480011
 [16]  0.290683796  0.851137908 -0.173909165 -0.677269594 -1.803116816
 [21] -0.818186249  1.796377216 -0.139089101 -0.479522104 -0.463418425
 [26]  0.093570882 -1.037539613 -1.565751455 -1.638141699 -0.102360516
 [31]  0.515627914  0.677693520  0.144680772  0.505407868  0.310489594
 [36] -1.855315901  1.786314454  0.249252647 -0.272056965 -0.066043178
 [41]  1.215544128 -0.054110588  1.505818936 -0.169031626  0.027419230
 [46] -0.533267639 -1.181409861 -1.885787833 -0.047131910 -0.091316283
 [51] -1.215064675 -2.080630856 -0.829585644 -0.258606831 -1.401558680
 [56]  0.814345638  0.728409581  1.535453941 -0.349082618 -1.542476938
 [61] -1.546997082  1.121158808  1.260204295 -0.394948859  0.316790683
 [66]  0.921039367  1.064595964  0.258249740  0.514063300 -1.087099595
 [71]  0.692103946 -0.512519323  0.687562917 -1.006400307 -2.296548494
 [76]  1.058761270  0.171764889 -0.045231139  0.307732410  0.456921343
 [81]  0.420700210  0.518668515 -0.001283587 -0.212555048  0.832912819
 [86] -0.309765213  1.629862009 -0.203749206  0.396223360  0.069005209
 [91]  1.684735099  0.370001401  0.184327327 -0.044534260 -0.513975958
 [96] -0.570739598 -0.937886801  0.089899276 -0.519997646  0.323164883
> 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.191081618 -0.051548918  1.291366365 -1.669481252 -0.444617073
  [6]  1.351185340  2.619972069  0.446253076 -1.203857484 -0.108777493
 [11]  1.392096814 -1.983055042  1.374554802  0.845573921 -1.995480011
 [16]  0.290683796  0.851137908 -0.173909165 -0.677269594 -1.803116816
 [21] -0.818186249  1.796377216 -0.139089101 -0.479522104 -0.463418425
 [26]  0.093570882 -1.037539613 -1.565751455 -1.638141699 -0.102360516
 [31]  0.515627914  0.677693520  0.144680772  0.505407868  0.310489594
 [36] -1.855315901  1.786314454  0.249252647 -0.272056965 -0.066043178
 [41]  1.215544128 -0.054110588  1.505818936 -0.169031626  0.027419230
 [46] -0.533267639 -1.181409861 -1.885787833 -0.047131910 -0.091316283
 [51] -1.215064675 -2.080630856 -0.829585644 -0.258606831 -1.401558680
 [56]  0.814345638  0.728409581  1.535453941 -0.349082618 -1.542476938
 [61] -1.546997082  1.121158808  1.260204295 -0.394948859  0.316790683
 [66]  0.921039367  1.064595964  0.258249740  0.514063300 -1.087099595
 [71]  0.692103946 -0.512519323  0.687562917 -1.006400307 -2.296548494
 [76]  1.058761270  0.171764889 -0.045231139  0.307732410  0.456921343
 [81]  0.420700210  0.518668515 -0.001283587 -0.212555048  0.832912819
 [86] -0.309765213  1.629862009 -0.203749206  0.396223360  0.069005209
 [91]  1.684735099  0.370001401  0.184327327 -0.044534260 -0.513975958
 [96] -0.570739598 -0.937886801  0.089899276 -0.519997646  0.323164883
> rowMin(tmp2)
  [1]  0.191081618 -0.051548918  1.291366365 -1.669481252 -0.444617073
  [6]  1.351185340  2.619972069  0.446253076 -1.203857484 -0.108777493
 [11]  1.392096814 -1.983055042  1.374554802  0.845573921 -1.995480011
 [16]  0.290683796  0.851137908 -0.173909165 -0.677269594 -1.803116816
 [21] -0.818186249  1.796377216 -0.139089101 -0.479522104 -0.463418425
 [26]  0.093570882 -1.037539613 -1.565751455 -1.638141699 -0.102360516
 [31]  0.515627914  0.677693520  0.144680772  0.505407868  0.310489594
 [36] -1.855315901  1.786314454  0.249252647 -0.272056965 -0.066043178
 [41]  1.215544128 -0.054110588  1.505818936 -0.169031626  0.027419230
 [46] -0.533267639 -1.181409861 -1.885787833 -0.047131910 -0.091316283
 [51] -1.215064675 -2.080630856 -0.829585644 -0.258606831 -1.401558680
 [56]  0.814345638  0.728409581  1.535453941 -0.349082618 -1.542476938
 [61] -1.546997082  1.121158808  1.260204295 -0.394948859  0.316790683
 [66]  0.921039367  1.064595964  0.258249740  0.514063300 -1.087099595
 [71]  0.692103946 -0.512519323  0.687562917 -1.006400307 -2.296548494
 [76]  1.058761270  0.171764889 -0.045231139  0.307732410  0.456921343
 [81]  0.420700210  0.518668515 -0.001283587 -0.212555048  0.832912819
 [86] -0.309765213  1.629862009 -0.203749206  0.396223360  0.069005209
 [91]  1.684735099  0.370001401  0.184327327 -0.044534260 -0.513975958
 [96] -0.570739598 -0.937886801  0.089899276 -0.519997646  0.323164883
> 
> colMeans(tmp2)
[1] -0.02481071
> colSums(tmp2)
[1] -2.481071
> colVars(tmp2)
[1] 1.020214
> colSd(tmp2)
[1] 1.010056
> colMax(tmp2)
[1] 2.619972
> colMin(tmp2)
[1] -2.296548
> colMedians(tmp2)
[1] -0.02290892
> colRanges(tmp2)
          [,1]
[1,] -2.296548
[2,]  2.619972
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.3526755 -3.1471759 -2.2303389 -4.6848657 -0.1386485  3.0404466
 [7] -1.6619817 -2.5709633  0.6281895 -1.9397446
> colApply(tmp,quantile)[,1]
             [,1]
[1,] -1.231652995
[2,] -0.469589862
[3,] -0.008106066
[4,]  0.454972816
[5,]  1.312237407
> 
> rowApply(tmp,sum)
 [1] -0.6785055  0.5288501 -1.5180917 -6.0460345 -2.0301848  1.4010096
 [7]  4.7828652 -5.0080077 -2.7866165 -1.7030422
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    7    5   10    2    4    4    3    6     5
 [2,]    4    6    3    1    1    6    8    9    9     1
 [3,]    2    5    6    4    5   10    9   10    1     4
 [4,]    7    1    2    6    9    1    6    7    2     6
 [5,]    5    8    1    7    3    7    5    8   10     3
 [6,]    6   10   10    8    4    8    7    4    4     2
 [7,]    3    2    9    9    6    2   10    2    3    10
 [8,]   10    3    4    5    8    3    2    1    7     7
 [9,]    8    9    7    2    7    5    3    6    5     9
[10,]    1    4    8    3   10    9    1    5    8     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.5933650  3.0708522 -1.4781965  0.7177889 -1.7908948 -4.9246113
 [7]  0.7619253  1.6332072  1.4033232 -0.9016917  0.1073329 -2.0476124
[13] -2.7518408 -4.5548274  0.3123033  2.1394028  2.0806037  2.0769557
[19] -0.7772512  2.8979033
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1985794
[2,] -1.0526574
[3,]  0.3319678
[4,]  0.9425270
[5,]  1.5701069
> 
> rowApply(tmp,sum)
[1]  2.6071224 -0.1562781  1.3574423 -2.8484719 -2.3917774
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18    5    3   15   16
[2,]   12   12    5   20   17
[3,]   19   18    6    2    1
[4,]   13   10    8   18    9
[5,]    7   16    2    8   12
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]         [,5]       [,6]
[1,]  1.5701069  0.4321990  1.8768531  0.44728716 -0.640960473 -0.8637336
[2,] -1.0526574  0.1255556  1.2622487  0.06313737  0.794526729 -1.2767569
[3,] -1.1985794 -0.8371329 -0.6987105 -0.48143853 -1.316231338 -0.3086058
[4,]  0.3319678  2.1880605 -1.8621110  1.25067548 -0.635104488 -1.0789851
[5,]  0.9425270  1.1621700 -2.0564769 -0.56187259  0.006874811 -1.3965299
           [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
[1,]  0.8068013  1.3694338 -0.03943903 -0.1510654 -0.6096525 -0.7520880
[2,]  1.8071354  0.8633158 -0.17688150 -0.5884740 -1.5972430  1.2891125
[3,] -0.6245337 -0.9351217 -0.36865729  0.7393330  1.0114312  0.8470039
[4,] -0.2512916  1.1391618  1.31570502 -0.1954183 -0.7725549 -2.0388285
[5,] -0.9761860 -0.8035825  0.67259596 -0.7060669  2.0753522 -1.3928123
          [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.2949175 -1.05524988 -1.6033703  0.6140376 -0.6759793  1.5657529
[2,]  0.1000414 -1.11661851 -0.8885419  0.3337893  0.5687635 -0.1946926
[3,] -1.6558536 -0.25413668  2.3059044  0.8143205  1.8461957  0.9393841
[4,] -0.7490339 -0.08093676 -0.1630975 -0.9265124  0.4796915 -0.6526088
[5,] -0.1520772 -2.04788559  0.6614085  1.3037677 -0.1380677  0.4191202
          [,19]      [,20]
[1,] -1.3434786  1.9545853
[2,]  0.7344689 -1.2065073
[3,]  0.4169332  1.1159376
[4,]  0.1942219 -0.3414726
[5,] -0.7793967  1.3753604
> 
> 
> 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.10-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.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  685  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.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  589  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.10-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 -1.945115 -0.9091309 0.7658524 0.6683893 -0.4861798 -0.7182272 -0.4712222
           col8      col9      col10    col11     col12     col13      col14
row1 -0.8449709 0.8674055 -0.3085495 1.212517 0.8356805 0.2990234 -0.5246808
           col15     col16      col17     col18     col19    col20
row1 -0.07053794 0.4477944 -0.2228991 0.8439087 0.2588821 1.381652
> tmp[,"col10"]
          col10
row1 -0.3085495
row2 -0.2017414
row3 -0.8530520
row4  2.3210819
row5 -2.0624604
> tmp[c("row1","row5"),]
          col1       col2      col3      col4       col5       col6       col7
row1 -1.945115 -0.9091309 0.7658524 0.6683893 -0.4861798 -0.7182272 -0.4712222
row5  1.664584  1.2474776 0.5452608 0.6875178 -0.1734855  0.3863665  0.3035393
           col8        col9      col10    col11     col12     col13      col14
row1 -0.8449709  0.86740552 -0.3085495 1.212517 0.8356805 0.2990234 -0.5246808
row5 -1.2642836 -0.03968873 -2.0624604 1.213983 1.6038826 0.1210007  1.6846576
           col15      col16      col17     col18     col19      col20
row1 -0.07053794  0.4477944 -0.2228991 0.8439087 0.2588821  1.3816518
row5  1.35507571 -2.2388909  0.9248525 1.4880189 1.9362651 -0.7914821
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.7182272  1.3816518
row2 -0.7159260  1.2340923
row3 -1.0965403  0.1644198
row4 -1.2717461  0.9990116
row5  0.3863665 -0.7914821
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.7182272  1.3816518
row5  0.3863665 -0.7914821
> 
> 
> 
> 
> 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.85653 47.99945 48.44179 50.22986 50.9451 106.3407 51.58004 49.28867
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.51868 49.21693 48.42741 50.79054 50.76063 50.89744 49.27947 50.13433
        col17    col18    col19    col20
row1 50.36672 50.46139 52.01763 105.6243
> tmp[,"col10"]
        col10
row1 49.21693
row2 29.34767
row3 29.57935
row4 29.12731
row5 48.14758
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.85653 47.99945 48.44179 50.22986 50.94510 106.3407 51.58004 49.28867
row5 49.53646 49.11328 48.73719 49.74526 52.00131 104.8700 50.10343 49.77365
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.51868 49.21693 48.42741 50.79054 50.76063 50.89744 49.27947 50.13433
row5 48.88032 48.14758 50.65688 50.34276 49.25113 50.01830 48.46731 49.13599
        col17    col18    col19    col20
row1 50.36672 50.46139 52.01763 105.6243
row5 50.61227 48.29677 49.49057 105.2472
> tmp[,c("col6","col20")]
          col6     col20
row1 106.34067 105.62429
row2  75.84335  75.81905
row3  75.44290  73.79321
row4  74.46809  74.55817
row5 104.87000 105.24718
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.3407 105.6243
row5 104.8700 105.2472
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.3407 105.6243
row5 104.8700 105.2472
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.77869184
[2,] -0.87146513
[3,] -2.06961365
[4,] -0.21732243
[5,] -0.06253815
> tmp[,c("col17","col7")]
            col17       col7
[1,] -2.522453588  0.8657469
[2,]  0.002985681  0.1917007
[3,]  1.553744028 -1.1436675
[4,]  0.158790426  0.8855300
[5,]  0.761315652  0.6609172
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.2624126 -0.3769302
[2,] -0.1922263  0.4154276
[3,]  1.0254092  0.4259909
[4,] -0.2716356 -0.8955023
[5,] -1.2752274 -0.1998242
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2624126
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.2624126
[2,] -0.1922263
> 
> 
> 
> 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.310478 -0.63112510 -0.1251368 0.9492375 -0.3278290  0.8918406  0.1444202
row1 1.529005  0.07570301 -0.5581717 0.1808425 -0.1494777 -1.0887160 -0.6395873
           [,8]       [,9]      [,10]      [,11]      [,12]      [,13]
row3 -0.5949876 -0.1756857 -0.2867652 -0.7245582 -0.7589539 -0.2648605
row1  0.2787322 -2.1405610 -0.4207252 -1.1153362 -1.7516513 -1.4419886
         [,14]     [,15]      [,16]      [,17]     [,18]     [,19]      [,20]
row3 0.7008772 0.6419777 -0.4034579 -0.2056969 0.7972745 -2.363780  1.9069772
row1 1.2867761 0.3237414  1.6167177 -0.2370326 1.6992933 -1.147707 -0.1966855
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]       [,3]       [,4]     [,5]      [,6]       [,7]
row2 -0.1953734 -1.328855 -0.7682657 -0.3423856 1.855489 0.2656328 -0.4799835
           [,8]      [,9]     [,10]
row2 -0.9457486 -1.200135 0.1925292
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]       [,4]       [,5]      [,6]      [,7]
row5 -0.207239 -2.263004 -0.1127138 -0.3476189 -0.1447623 -1.715566 0.4465441
         [,8]      [,9]      [,10]     [,11]    [,12]     [,13]      [,14]
row5 1.101269 -0.853284 0.03760334 0.9034665 1.708667 -1.207187 0.07290135
          [,15]    [,16]    [,17]    [,18]    [,19]     [,20]
row5 0.02538171 1.008777 0.652652 1.130032 2.123496 0.2666376
> 
> 
> 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: 0x0000000004f1e530>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa05bd9764f"
 [2] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa06ddc3a78"
 [3] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa03d7b2f1e"
 [4] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa0e552ea5" 
 [5] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa04a8e7df0"
 [6] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa0243f7c17"
 [7] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa02b2b2cac"
 [8] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa041285910"
 [9] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa06aeb29b9"
[10] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa028165e52"
[11] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa014ad4414"
[12] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa0676d43d7"
[13] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa03b936da0"
[14] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa04a1255c1"
[15] "C:/Users/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1fa0154e77be"
> 
> 
> ### 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: 0x0000000005cdf960>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0000000005cdf960>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.10-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0000000005cdf960>
> rowMedians(tmp)
  [1] -0.0824731839 -0.2220422223 -0.3964814844  0.0623301778 -0.0052697151
  [6]  0.0017710246  0.1626357097  0.0058675640 -0.0255060457  0.5574797621
 [11]  0.2536327502 -0.0339465017  0.1686494134  0.3715870806  0.0377400834
 [16]  0.1895652443 -0.1112304589  0.0809712752  0.2591402924 -0.2610096145
 [21] -0.4086520988  0.0335384941 -0.7441895303  0.3840542008  0.0647137562
 [26] -0.0081060209 -0.1844756924  0.4639616031 -0.2534284934  0.0540746825
 [31]  0.1809181789  0.2090687556  0.0881082379  0.4214777050  0.1073021692
 [36] -0.3129256489 -0.1158797299 -0.4009121221 -0.1675521467  0.4071451903
 [41] -0.2245337054 -0.2579889324 -0.0818939459 -0.0847147407  0.0861409226
 [46] -0.2817248071  0.2385251789 -0.2639545052  0.1219951877 -0.3805382286
 [51] -0.2653343003  0.0431270697  0.3642870281  0.2952098384  0.5867267071
 [56] -0.3339699204  0.0473815524  0.1386910104  0.1552763172 -0.2373960001
 [61]  0.1633632271  0.5385213969  0.0799241272  0.0498751904 -0.6747416810
 [66]  0.1485147506 -0.7100400602  0.4774181289 -0.0250675965 -0.3100196292
 [71]  0.4740896931 -0.2651472929  0.1238154935  0.0515877654 -0.0237465391
 [76] -0.0886544790 -0.1975840452  0.1135095653  0.1558483512 -0.1166284668
 [81] -0.3950651267  0.1975439742 -0.1407630564 -0.0213058345  0.0769820335
 [86] -0.1802832933 -0.0693963525  0.3289369112  0.0796456457 -0.0983230153
 [91] -0.1468758014 -0.7729081093  0.0250155707  0.2774325618  0.1949449792
 [96]  0.2044752949  0.0010601074  0.1344900013  0.0405391813 -0.3811161282
[101] -0.2129455587 -0.1003396784  0.4861373272  0.1361427148 -0.2918805909
[106] -0.2755856185 -0.2171806535 -0.1244960081  0.3053648753 -0.3401043421
[111] -0.0815185449 -0.1080325980  0.3124662416  0.1621094192 -0.4618474044
[116]  0.3767061301  0.4264846113  0.0238909336 -0.2605928346 -0.0836720991
[121] -0.1701695265 -0.3819011385 -0.1548979066 -0.3800025815  0.3316144191
[126] -0.0782321175 -0.1057794382 -0.0687983574 -0.1772156581 -0.0611286080
[131]  0.2061776507  0.1943744607  0.3993892058  0.1181850916  0.0931491859
[136] -0.0281502445 -0.1041989684 -0.0606729686  0.4163648227  0.2443429534
[141]  0.4215396090  0.4312535323 -0.0137944455 -0.2288032113  0.0737578200
[146] -0.5884702321 -0.2967157548 -0.0928022137  0.0279730078  0.6449912752
[151]  0.2088248571 -0.3681934030 -0.1110295758  0.0951977333 -0.2579360629
[156]  0.2092165155  0.1307602185  0.0222480675 -0.0455744853  0.2396355977
[161]  0.6386104577 -0.0108009156  0.5628866402 -0.4106836163  0.0522788395
[166]  0.2271549758  0.6156579784 -0.3100988522 -0.2269497329 -0.0373855425
[171] -0.1292307414  0.1098879495 -0.2652314742 -0.2716071165 -0.1470920410
[176]  0.2691431799  0.1569781710 -0.4122883392  0.5649443786  0.0065204412
[181]  0.4678463075  0.3984181530 -0.1379013910 -0.1784783778  0.0041479864
[186] -0.0133340308  0.1361004830 -0.2111076758  0.5886399224  0.7572599463
[191] -0.0551020602 -0.2428776839 -0.0548380205  0.4208723633 -0.0430557878
[196] -0.0864793825 -0.2213143867  0.3021469551  0.0520458623 -0.2891593456
[201]  0.0544382644 -0.0327952287 -0.1393992283 -0.3539739132 -0.0012332355
[206] -0.1951046519 -0.0629549781 -0.5559202610 -0.1429147717 -0.0023920937
[211]  0.0126300541 -0.8017882489 -0.0063948340  0.0170095972  0.2656714676
[216] -0.7276775816 -0.3523560326 -0.0984968046 -0.3540878628 -0.0005457034
[221] -0.1148171775 -0.2191788975  0.2904037365  0.2671823758 -0.2200856263
[226]  0.2079269953 -0.5625199322  0.7178582781 -0.1203381477 -0.2612137523
> 
> proc.time()
   user  system elapsed 
   2.71    7.79   10.71 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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: 0x0364c348>
> .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: 0x0364c348>
> .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: 0x0364c348>
> .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: 0x0364c348>
> 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: 0x03a575e8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03a575e8>
> .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: 0x03a575e8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03a575e8>
> .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: 0x03a575e8>
> 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: 0x026d3370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x026d3370>
> .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: 0x026d3370>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x026d3370>
> .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: 0x026d3370>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x026d3370>
> .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: 0x026d3370>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x026d3370>
> .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: 0x026d3370>
> 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: 0x029c9158>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x029c9158>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029c9158>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029c9158>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2b043e074121" "BufferedMatrixFile2b047bd82b32"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2b043e074121" "BufferedMatrixFile2b047bd82b32"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x02ff9210>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02ff9210>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02ff9210>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02ff9210>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x02ff9210>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x02ff9210>
> .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: 0x02ff5380>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02ff5380>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x02ff5380>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x02ff5380>
> 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: 0x02e21780>
> .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: 0x02e21780>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.32    0.04    0.35 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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: 0x0000000005e43520>
> .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: 0x0000000005e43520>
> .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: 0x0000000005e43520>
> .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: 0x0000000005e43520>
> 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: 0x0000000007670af8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007670af8>
> .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: 0x0000000007670af8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007670af8>
> .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: 0x0000000007670af8>
> 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: 0x0000000005fbbf00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005fbbf00>
> .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: 0x0000000005fbbf00>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005fbbf00>
> .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: 0x0000000005fbbf00>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005fbbf00>
> .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: 0x0000000005fbbf00>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005fbbf00>
> .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: 0x0000000005fbbf00>
> 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: 0x0000000005cedea0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000005cedea0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005cedea0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005cedea0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22185683526d" "BufferedMatrixFile2218585d3fa0"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22185683526d" "BufferedMatrixFile2218585d3fa0"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005e24be8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005e24be8>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005e24be8>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005e24be8>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005e24be8>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005e24be8>
> .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: 0x0000000005ac6560>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005ac6560>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005ac6560>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000000005ac6560>
> 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: 0x0000000007581930>
> .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: 0x0000000007581930>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.46    0.15    0.60 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.37    0.01    0.37 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
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.35    0.03    0.37 

Example timings