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

This page was generated on 2021-10-15 15:05:59 -0400 (Fri, 15 Oct 2021).

CHECK results for BufferedMatrix on tokay2

To the developers/maintainers of the BufferedMatrix package:
- Please allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to
reflect on this report. See How and When does the builder pull? When will my changes propagate? here for more information.
- Make sure to use the following settings in order to reproduce any error or warning you see on this page.

raw results

Package 220/2041HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.56.0  (landing page)
Ben Bolstad
Snapshot Date: 2021-10-14 04:50:12 -0400 (Thu, 14 Oct 2021)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_13
git_last_commit: 64ce6a6
git_last_commit_date: 2021-05-19 11:38:39 -0400 (Wed, 19 May 2021)
nebbiolo1Linux (Ubuntu 20.04.2 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
tokay2Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
machv2macOS 10.14.6 Mojave / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.56.0
Command: C:\Users\biocbuild\bbs-3.13-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.13-bioc\R\library --no-vignettes --timings BufferedMatrix_1.56.0.tar.gz
StartedAt: 2021-10-14 20:28:49 -0400 (Thu, 14 Oct 2021)
EndedAt: 2021-10-14 20:29:59 -0400 (Thu, 14 Oct 2021)
EllapsedTime: 69.8 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory 'C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.1.1 (2021-08-10)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using option '--no-vignettes'
* checking for file 'BufferedMatrix/DESCRIPTION' ... OK
* this is package 'BufferedMatrix' version '1.56.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.13-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.13-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.13-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\cygwin\bin\curl.exe -O http://155.52.207.165/BBS/3.13/bioc/src/contrib/BufferedMatrix_1.56.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.13-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.56.0.tar.gz && C:\Users\biocbuild\bbs-3.13-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.56.0.zip && rm BufferedMatrix_1.56.0.tar.gz BufferedMatrix_1.56.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
 49  201k   49  100k    0     0   495k      0 --:--:-- --:--:-- --:--:--  496k
100  201k  100  201k    0     0   839k      0 --:--:-- --:--:-- --:--:--  840k

install for i386

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

install for x64

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

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
   0.53    0.10    0.60 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
   0.48    0.04    0.51 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "C:/Users/biocbuild/bbs-3.13-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 436478 13.4     923344 28.2   647471 19.8
Vcells 500011  3.9    8388608 64.0  1649572 12.6
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Oct 14 20:29:23 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Oct 14 20:29:23 2021"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x03f0a410>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Oct 14 20:29:25 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Oct 14 20:29:26 2021"
> 
> ColMode(tmp2)
<pointer: 0x03f0a410>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]        [,2]       [,3]       [,4]
[1,] 99.1087361 -0.10937721  0.3130854  1.2211581
[2,] -0.9413282 -1.23707063  0.0258911 -1.6437836
[3,]  1.4679012 -0.07710761 -1.2555935  0.9102179
[4,] -1.1329666  0.65188715 -0.4563682 -0.0258986
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]      [,4]
[1,] 99.1087361 0.10937721 0.3130854 1.2211581
[2,]  0.9413282 1.23707063 0.0258911 1.6437836
[3,]  1.4679012 0.07710761 1.2555935 0.9102179
[4,]  1.1329666 0.65188715 0.4563682 0.0258986
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.13-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.9553371 0.3307223 0.5595403 1.1050602
[2,] 0.9702207 1.1122368 0.1609071 1.2821012
[3,] 1.2115697 0.2776826 1.1205327 0.9540534
[4,] 1.0644091 0.8073953 0.6755503 0.1609304
> 
> 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.13-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.66211 28.41660 30.90849 37.27176
[2,]  35.64354 37.35944 26.63496 39.46480
[3,]  38.58360 27.85393 37.46092 35.45075
[4,]  36.77706 33.72584 32.21187 26.63520
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x02cf2210>
> exp(tmp5)
<pointer: 0x02cf2210>
> log(tmp5,2)
<pointer: 0x02cf2210>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.5234
> Min(tmp5)
[1] 54.32603
> mean(tmp5)
[1] 72.18829
> Sum(tmp5)
[1] 14437.66
> Var(tmp5)
[1] 845.406
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.03465 69.56728 70.45660 69.20637 70.33832 72.49678 72.59108 69.50694
 [9] 67.32104 71.36384
> rowSums(tmp5)
 [1] 1780.693 1391.346 1409.132 1384.127 1406.766 1449.936 1451.822 1390.139
 [9] 1346.421 1427.277
> rowVars(tmp5)
 [1] 7913.27767   64.35818   68.20901   43.67546   77.38962   59.45463
 [7]   53.19102   87.46439   38.32446   93.59297
> rowSd(tmp5)
 [1] 88.956606  8.022355  8.258874  6.608741  8.797137  7.710683  7.293217
 [8]  9.352240  6.190675  9.674346
> rowMax(tmp5)
 [1] 465.52337  82.14080  85.50850  81.31771  86.98667  84.18625  85.02542
 [8]  83.06853  76.99740  92.12320
> rowMin(tmp5)
 [1] 55.90425 54.40341 56.61471 55.43768 54.32603 59.91456 60.29454 55.26136
 [9] 56.98548 58.28644
> 
> colMeans(tmp5)
 [1] 109.42709  68.03702  66.98526  71.24005  72.44265  68.62411  72.63156
 [8]  68.62579  68.66935  69.67981  69.09487  75.09564  67.40236  71.18496
[15]  69.73413  73.15408  70.30146  73.19252  67.49784  70.74523
> colSums(tmp5)
 [1] 1094.2709  680.3702  669.8526  712.4005  724.4265  686.2411  726.3156
 [8]  686.2579  686.6935  696.7981  690.9487  750.9564  674.0236  711.8496
[15]  697.3413  731.5408  703.0146  731.9252  674.9784  707.4523
> colVars(tmp5)
 [1] 15695.94598    81.93472    70.41065    67.23984    87.30677    34.07494
 [7]    90.41093    50.31189   100.58442    29.67757    83.29062    86.03565
[13]    63.91886    99.95291    26.76935    46.66054    82.36871    78.23537
[19]    57.71851    33.56889
> colSd(tmp5)
 [1] 125.283463   9.051780   8.391105   8.199990   9.343809   5.837375
 [7]   9.508466   7.093087  10.029178   5.447712   9.126370   9.275540
[13]   7.994927   9.997645   5.173911   6.830852   9.075721   8.845076
[19]   7.597270   5.793866
> colMax(tmp5)
 [1] 465.52337  81.17477  78.78928  82.14080  85.02542  79.33717  86.98667
 [8]  77.73962  85.50850  77.46001  82.51631  89.09134  82.24562  92.12320
[15]  78.65130  81.87022  82.54317  84.47545  80.30353  79.22618
> colMin(tmp5)
 [1] 57.82424 55.64806 55.43718 55.43768 55.58788 58.28644 56.94768 56.61471
 [9] 58.41574 62.70793 55.26136 60.98963 56.95717 55.90425 63.38267 57.67152
[17] 54.32603 57.30828 54.40341 60.72611
> 
> 
> ### 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] 89.03465 69.56728       NA 69.20637 70.33832 72.49678 72.59108 69.50694
 [9] 67.32104 71.36384
> rowSums(tmp5)
 [1] 1780.693 1391.346       NA 1384.127 1406.766 1449.936 1451.822 1390.139
 [9] 1346.421 1427.277
> rowVars(tmp5)
 [1] 7913.27767   64.35818   71.35012   43.67546   77.38962   59.45463
 [7]   53.19102   87.46439   38.32446   93.59297
> rowSd(tmp5)
 [1] 88.956606  8.022355  8.446900  6.608741  8.797137  7.710683  7.293217
 [8]  9.352240  6.190675  9.674346
> rowMax(tmp5)
 [1] 465.52337  82.14080        NA  81.31771  86.98667  84.18625  85.02542
 [8]  83.06853  76.99740  92.12320
> rowMin(tmp5)
 [1] 55.90425 54.40341       NA 55.43768 54.32603 59.91456 60.29454 55.26136
 [9] 56.98548 58.28644
> 
> colMeans(tmp5)
 [1] 109.42709  68.03702  66.98526        NA  72.44265  68.62411  72.63156
 [8]  68.62579  68.66935  69.67981  69.09487  75.09564  67.40236  71.18496
[15]  69.73413  73.15408  70.30146  73.19252  67.49784  70.74523
> colSums(tmp5)
 [1] 1094.2709  680.3702  669.8526        NA  724.4265  686.2411  726.3156
 [8]  686.2579  686.6935  696.7981  690.9487  750.9564  674.0236  711.8496
[15]  697.3413  731.5408  703.0146  731.9252  674.9784  707.4523
> colVars(tmp5)
 [1] 15695.94598    81.93472    70.41065          NA    87.30677    34.07494
 [7]    90.41093    50.31189   100.58442    29.67757    83.29062    86.03565
[13]    63.91886    99.95291    26.76935    46.66054    82.36871    78.23537
[19]    57.71851    33.56889
> colSd(tmp5)
 [1] 125.283463   9.051780   8.391105         NA   9.343809   5.837375
 [7]   9.508466   7.093087  10.029178   5.447712   9.126370   9.275540
[13]   7.994927   9.997645   5.173911   6.830852   9.075721   8.845076
[19]   7.597270   5.793866
> colMax(tmp5)
 [1] 465.52337  81.17477  78.78928        NA  85.02542  79.33717  86.98667
 [8]  77.73962  85.50850  77.46001  82.51631  89.09134  82.24562  92.12320
[15]  78.65130  81.87022  82.54317  84.47545  80.30353  79.22618
> colMin(tmp5)
 [1] 57.82424 55.64806 55.43718       NA 55.58788 58.28644 56.94768 56.61471
 [9] 58.41574 62.70793 55.26136 60.98963 56.95717 55.90425 63.38267 57.67152
[17] 54.32603 57.30828 54.40341 60.72611
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.5234
> Min(tmp5,na.rm=TRUE)
[1] 54.32603
> mean(tmp5,na.rm=TRUE)
[1] 72.18026
> Sum(tmp5,na.rm=TRUE)
[1] 14363.87
> Var(tmp5,na.rm=TRUE)
[1] 849.6628
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.03465 69.56728 70.28136 69.20637 70.33832 72.49678 72.59108 69.50694
 [9] 67.32104 71.36384
> rowSums(tmp5,na.rm=TRUE)
 [1] 1780.693 1391.346 1335.346 1384.127 1406.766 1449.936 1451.822 1390.139
 [9] 1346.421 1427.277
> rowVars(tmp5,na.rm=TRUE)
 [1] 7913.27767   64.35818   71.35012   43.67546   77.38962   59.45463
 [7]   53.19102   87.46439   38.32446   93.59297
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.956606  8.022355  8.446900  6.608741  8.797137  7.710683  7.293217
 [8]  9.352240  6.190675  9.674346
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.52337  82.14080  85.50850  81.31771  86.98667  84.18625  85.02542
 [8]  83.06853  76.99740  92.12320
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.90425 54.40341 56.61471 55.43768 54.32603 59.91456 60.29454 55.26136
 [9] 56.98548 58.28644
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.42709  68.03702  66.98526  70.95715  72.44265  68.62411  72.63156
 [8]  68.62579  68.66935  69.67981  69.09487  75.09564  67.40236  71.18496
[15]  69.73413  73.15408  70.30146  73.19252  67.49784  70.74523
> colSums(tmp5,na.rm=TRUE)
 [1] 1094.2709  680.3702  669.8526  638.6144  724.4265  686.2411  726.3156
 [8]  686.2579  686.6935  696.7981  690.9487  750.9564  674.0236  711.8496
[15]  697.3413  731.5408  703.0146  731.9252  674.9784  707.4523
> colVars(tmp5,na.rm=TRUE)
 [1] 15695.94598    81.93472    70.41065    74.74449    87.30677    34.07494
 [7]    90.41093    50.31189   100.58442    29.67757    83.29062    86.03565
[13]    63.91886    99.95291    26.76935    46.66054    82.36871    78.23537
[19]    57.71851    33.56889
> colSd(tmp5,na.rm=TRUE)
 [1] 125.283463   9.051780   8.391105   8.645490   9.343809   5.837375
 [7]   9.508466   7.093087  10.029178   5.447712   9.126370   9.275540
[13]   7.994927   9.997645   5.173911   6.830852   9.075721   8.845076
[19]   7.597270   5.793866
> colMax(tmp5,na.rm=TRUE)
 [1] 465.52337  81.17477  78.78928  82.14080  85.02542  79.33717  86.98667
 [8]  77.73962  85.50850  77.46001  82.51631  89.09134  82.24562  92.12320
[15]  78.65130  81.87022  82.54317  84.47545  80.30353  79.22618
> colMin(tmp5,na.rm=TRUE)
 [1] 57.82424 55.64806 55.43718 55.43768 55.58788 58.28644 56.94768 56.61471
 [9] 58.41574 62.70793 55.26136 60.98963 56.95717 55.90425 63.38267 57.67152
[17] 54.32603 57.30828 54.40341 60.72611
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.03465 69.56728      NaN 69.20637 70.33832 72.49678 72.59108 69.50694
 [9] 67.32104 71.36384
> rowSums(tmp5,na.rm=TRUE)
 [1] 1780.693 1391.346    0.000 1384.127 1406.766 1449.936 1451.822 1390.139
 [9] 1346.421 1427.277
> rowVars(tmp5,na.rm=TRUE)
 [1] 7913.27767   64.35818         NA   43.67546   77.38962   59.45463
 [7]   53.19102   87.46439   38.32446   93.59297
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.956606  8.022355        NA  6.608741  8.797137  7.710683  7.293217
 [8]  9.352240  6.190675  9.674346
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.52337  82.14080        NA  81.31771  86.98667  84.18625  85.02542
 [8]  83.06853  76.99740  92.12320
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.90425 54.40341       NA 55.43768 54.32603 59.91456 60.29454 55.26136
 [9] 56.98548 58.28644
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.66269  69.15510  65.76474       NaN  71.69443  68.86643  72.86327
 [8]  69.96036  66.79833  70.45446  70.22283  74.41966  67.54207  72.10702
[15]  70.05362  72.79693  70.32752  72.88318  67.36297  70.72124
> colSums(tmp5,na.rm=TRUE)
 [1] 1013.9642  622.3959  591.8826    0.0000  645.2499  619.7979  655.7694
 [8]  629.6432  601.1850  634.0901  632.0054  669.7769  607.8786  648.9632
[15]  630.4826  655.1724  632.9476  655.9486  606.2667  636.4911
> colVars(tmp5,na.rm=TRUE)
 [1] 17540.16185    78.11292    62.45304          NA    91.92206    37.67374
 [7]   101.10829    36.56391    73.77452    26.63629    79.38887    91.64940
[13]    71.68914   102.88229    28.96716    51.05811    92.65716    86.93827
[19]    64.72869    37.75852
> colSd(tmp5,na.rm=TRUE)
 [1] 132.439276   8.838152   7.902723         NA   9.587599   6.137894
 [7]  10.055262   6.046810   8.589210   5.161036   8.910043   9.573369
[13]   8.466944  10.143091   5.382115   7.145496   9.625859   9.324069
[19]   8.045414   6.144797
> colMax(tmp5,na.rm=TRUE)
 [1] 465.52337  81.17477  78.78928      -Inf  85.02542  79.33717  86.98667
 [8]  77.73962  80.66776  77.46001  82.51631  89.09134  82.24562  92.12320
[15]  78.65130  81.87022  82.54317  84.47545  80.30353  79.22618
> colMin(tmp5,na.rm=TRUE)
 [1] 57.82424 55.64806 55.43718      Inf 55.58788 58.28644 56.94768 60.69079
 [9] 58.41574 63.46254 55.26136 60.98963 56.95717 55.90425 63.38267 57.67152
[17] 54.32603 57.30828 54.40341 60.72611
> 
> 
> 
> 
> 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] 383.9486 231.7916 254.9219 280.0638 189.6591 248.2555 228.0855 206.0093
 [9] 352.3648 117.2050
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 383.9486 231.7916 254.9219 280.0638 189.6591 248.2555 228.0855 206.0093
 [9] 352.3648 117.2050
> 
> 
> 
> 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-14 -1.989520e-13  5.684342e-14 -5.684342e-14  0.000000e+00
 [6] -5.684342e-14  5.684342e-14  0.000000e+00  0.000000e+00 -1.278977e-13
[11]  1.705303e-13  7.105427e-14 -8.526513e-14  7.105427e-14  8.526513e-14
[16] -5.684342e-14  8.526513e-14 -1.421085e-13  1.136868e-13 -1.989520e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
6   1 
7   17 
4   8 
2   1 
4   3 
10   20 
1   20 
5   17 
10   20 
6   12 
8   19 
9   14 
5   10 
7   11 
8   5 
9   7 
5   7 
6   12 
6   16 
10   7 
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.336277
> Min(tmp)
[1] -2.958178
> mean(tmp)
[1] -0.009007844
> Sum(tmp)
[1] -0.9007844
> Var(tmp)
[1] 1.027373
> 
> rowMeans(tmp)
[1] -0.009007844
> rowSums(tmp)
[1] -0.9007844
> rowVars(tmp)
[1] 1.027373
> rowSd(tmp)
[1] 1.013594
> rowMax(tmp)
[1] 2.336277
> rowMin(tmp)
[1] -2.958178
> 
> colMeans(tmp)
  [1]  0.1962574300  1.1920669790 -0.6626257145  0.4725487948 -1.2186934965
  [6]  1.0351393321 -1.8386290182  1.1283327816  0.9171174872  0.5009712930
 [11] -0.1216367214  0.0076109558  0.9194434135  1.1648655744  1.6488365642
 [16] -2.0188326593  1.1753794373  1.5350202020  0.7206188620 -0.0690453720
 [21] -1.3735873397 -0.6100906850  0.3163685051  1.1669670171  0.6075458236
 [26] -0.9137106358  1.5442426446 -0.4756454148  0.7268936176  1.9191014641
 [31]  0.3194202595 -0.0413341531  0.1495576325 -1.8372268154  0.2980314230
 [36]  0.9673386887 -1.5055380480  1.0537238868 -0.8320616003 -0.6348908713
 [41]  0.2786741328  0.1939762009  0.9477836638  0.9943109986  2.3362768741
 [46]  0.7896215122  0.1793512320 -0.0642937389 -0.8975961164 -1.1015530283
 [51] -1.0601079048  1.9600163058  1.5524125812 -0.1397562031  0.6783558681
 [56]  1.1732302603  0.5185022325  0.8954781714  0.4128933583 -0.2276166890
 [61] -0.1080451197 -2.0702627417 -1.4470852587 -0.1758287422 -2.1123267531
 [66] -0.9950771154 -0.7921032117  0.6842536749  0.2093707781 -2.9581778696
 [71] -0.0008490057 -0.9679108199 -0.5477978273 -1.6710080925  0.4973721412
 [76] -0.8483982251  0.3348772304 -0.2002162622 -0.2851429325  0.0604623107
 [81] -0.0515323684 -0.5483314988 -0.1756486187 -0.4221690840  0.2296194998
 [86] -1.1845940329 -0.0123354917  0.2792240461 -0.4916246808  0.3286666253
 [91]  0.3857465429  0.6739269748  0.3266892462 -0.2322819288  1.2391328976
 [96] -1.1092638592 -1.2572362783 -0.5236749871 -1.0077473259 -0.9032675162
> colSums(tmp)
  [1]  0.1962574300  1.1920669790 -0.6626257145  0.4725487948 -1.2186934965
  [6]  1.0351393321 -1.8386290182  1.1283327816  0.9171174872  0.5009712930
 [11] -0.1216367214  0.0076109558  0.9194434135  1.1648655744  1.6488365642
 [16] -2.0188326593  1.1753794373  1.5350202020  0.7206188620 -0.0690453720
 [21] -1.3735873397 -0.6100906850  0.3163685051  1.1669670171  0.6075458236
 [26] -0.9137106358  1.5442426446 -0.4756454148  0.7268936176  1.9191014641
 [31]  0.3194202595 -0.0413341531  0.1495576325 -1.8372268154  0.2980314230
 [36]  0.9673386887 -1.5055380480  1.0537238868 -0.8320616003 -0.6348908713
 [41]  0.2786741328  0.1939762009  0.9477836638  0.9943109986  2.3362768741
 [46]  0.7896215122  0.1793512320 -0.0642937389 -0.8975961164 -1.1015530283
 [51] -1.0601079048  1.9600163058  1.5524125812 -0.1397562031  0.6783558681
 [56]  1.1732302603  0.5185022325  0.8954781714  0.4128933583 -0.2276166890
 [61] -0.1080451197 -2.0702627417 -1.4470852587 -0.1758287422 -2.1123267531
 [66] -0.9950771154 -0.7921032117  0.6842536749  0.2093707781 -2.9581778696
 [71] -0.0008490057 -0.9679108199 -0.5477978273 -1.6710080925  0.4973721412
 [76] -0.8483982251  0.3348772304 -0.2002162622 -0.2851429325  0.0604623107
 [81] -0.0515323684 -0.5483314988 -0.1756486187 -0.4221690840  0.2296194998
 [86] -1.1845940329 -0.0123354917  0.2792240461 -0.4916246808  0.3286666253
 [91]  0.3857465429  0.6739269748  0.3266892462 -0.2322819288  1.2391328976
 [96] -1.1092638592 -1.2572362783 -0.5236749871 -1.0077473259 -0.9032675162
> 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.1962574300  1.1920669790 -0.6626257145  0.4725487948 -1.2186934965
  [6]  1.0351393321 -1.8386290182  1.1283327816  0.9171174872  0.5009712930
 [11] -0.1216367214  0.0076109558  0.9194434135  1.1648655744  1.6488365642
 [16] -2.0188326593  1.1753794373  1.5350202020  0.7206188620 -0.0690453720
 [21] -1.3735873397 -0.6100906850  0.3163685051  1.1669670171  0.6075458236
 [26] -0.9137106358  1.5442426446 -0.4756454148  0.7268936176  1.9191014641
 [31]  0.3194202595 -0.0413341531  0.1495576325 -1.8372268154  0.2980314230
 [36]  0.9673386887 -1.5055380480  1.0537238868 -0.8320616003 -0.6348908713
 [41]  0.2786741328  0.1939762009  0.9477836638  0.9943109986  2.3362768741
 [46]  0.7896215122  0.1793512320 -0.0642937389 -0.8975961164 -1.1015530283
 [51] -1.0601079048  1.9600163058  1.5524125812 -0.1397562031  0.6783558681
 [56]  1.1732302603  0.5185022325  0.8954781714  0.4128933583 -0.2276166890
 [61] -0.1080451197 -2.0702627417 -1.4470852587 -0.1758287422 -2.1123267531
 [66] -0.9950771154 -0.7921032117  0.6842536749  0.2093707781 -2.9581778696
 [71] -0.0008490057 -0.9679108199 -0.5477978273 -1.6710080925  0.4973721412
 [76] -0.8483982251  0.3348772304 -0.2002162622 -0.2851429325  0.0604623107
 [81] -0.0515323684 -0.5483314988 -0.1756486187 -0.4221690840  0.2296194998
 [86] -1.1845940329 -0.0123354917  0.2792240461 -0.4916246808  0.3286666253
 [91]  0.3857465429  0.6739269748  0.3266892462 -0.2322819288  1.2391328976
 [96] -1.1092638592 -1.2572362783 -0.5236749871 -1.0077473259 -0.9032675162
> colMin(tmp)
  [1]  0.1962574300  1.1920669790 -0.6626257145  0.4725487948 -1.2186934965
  [6]  1.0351393321 -1.8386290182  1.1283327816  0.9171174872  0.5009712930
 [11] -0.1216367214  0.0076109558  0.9194434135  1.1648655744  1.6488365642
 [16] -2.0188326593  1.1753794373  1.5350202020  0.7206188620 -0.0690453720
 [21] -1.3735873397 -0.6100906850  0.3163685051  1.1669670171  0.6075458236
 [26] -0.9137106358  1.5442426446 -0.4756454148  0.7268936176  1.9191014641
 [31]  0.3194202595 -0.0413341531  0.1495576325 -1.8372268154  0.2980314230
 [36]  0.9673386887 -1.5055380480  1.0537238868 -0.8320616003 -0.6348908713
 [41]  0.2786741328  0.1939762009  0.9477836638  0.9943109986  2.3362768741
 [46]  0.7896215122  0.1793512320 -0.0642937389 -0.8975961164 -1.1015530283
 [51] -1.0601079048  1.9600163058  1.5524125812 -0.1397562031  0.6783558681
 [56]  1.1732302603  0.5185022325  0.8954781714  0.4128933583 -0.2276166890
 [61] -0.1080451197 -2.0702627417 -1.4470852587 -0.1758287422 -2.1123267531
 [66] -0.9950771154 -0.7921032117  0.6842536749  0.2093707781 -2.9581778696
 [71] -0.0008490057 -0.9679108199 -0.5477978273 -1.6710080925  0.4973721412
 [76] -0.8483982251  0.3348772304 -0.2002162622 -0.2851429325  0.0604623107
 [81] -0.0515323684 -0.5483314988 -0.1756486187 -0.4221690840  0.2296194998
 [86] -1.1845940329 -0.0123354917  0.2792240461 -0.4916246808  0.3286666253
 [91]  0.3857465429  0.6739269748  0.3266892462 -0.2322819288  1.2391328976
 [96] -1.1092638592 -1.2572362783 -0.5236749871 -1.0077473259 -0.9032675162
> colMedians(tmp)
  [1]  0.1962574300  1.1920669790 -0.6626257145  0.4725487948 -1.2186934965
  [6]  1.0351393321 -1.8386290182  1.1283327816  0.9171174872  0.5009712930
 [11] -0.1216367214  0.0076109558  0.9194434135  1.1648655744  1.6488365642
 [16] -2.0188326593  1.1753794373  1.5350202020  0.7206188620 -0.0690453720
 [21] -1.3735873397 -0.6100906850  0.3163685051  1.1669670171  0.6075458236
 [26] -0.9137106358  1.5442426446 -0.4756454148  0.7268936176  1.9191014641
 [31]  0.3194202595 -0.0413341531  0.1495576325 -1.8372268154  0.2980314230
 [36]  0.9673386887 -1.5055380480  1.0537238868 -0.8320616003 -0.6348908713
 [41]  0.2786741328  0.1939762009  0.9477836638  0.9943109986  2.3362768741
 [46]  0.7896215122  0.1793512320 -0.0642937389 -0.8975961164 -1.1015530283
 [51] -1.0601079048  1.9600163058  1.5524125812 -0.1397562031  0.6783558681
 [56]  1.1732302603  0.5185022325  0.8954781714  0.4128933583 -0.2276166890
 [61] -0.1080451197 -2.0702627417 -1.4470852587 -0.1758287422 -2.1123267531
 [66] -0.9950771154 -0.7921032117  0.6842536749  0.2093707781 -2.9581778696
 [71] -0.0008490057 -0.9679108199 -0.5477978273 -1.6710080925  0.4973721412
 [76] -0.8483982251  0.3348772304 -0.2002162622 -0.2851429325  0.0604623107
 [81] -0.0515323684 -0.5483314988 -0.1756486187 -0.4221690840  0.2296194998
 [86] -1.1845940329 -0.0123354917  0.2792240461 -0.4916246808  0.3286666253
 [91]  0.3857465429  0.6739269748  0.3266892462 -0.2322819288  1.2391328976
 [96] -1.1092638592 -1.2572362783 -0.5236749871 -1.0077473259 -0.9032675162
> colRanges(tmp)
          [,1]     [,2]       [,3]      [,4]      [,5]     [,6]      [,7]
[1,] 0.1962574 1.192067 -0.6626257 0.4725488 -1.218693 1.035139 -1.838629
[2,] 0.1962574 1.192067 -0.6626257 0.4725488 -1.218693 1.035139 -1.838629
         [,8]      [,9]     [,10]      [,11]       [,12]     [,13]    [,14]
[1,] 1.128333 0.9171175 0.5009713 -0.1216367 0.007610956 0.9194434 1.164866
[2,] 1.128333 0.9171175 0.5009713 -0.1216367 0.007610956 0.9194434 1.164866
        [,15]     [,16]    [,17]   [,18]     [,19]       [,20]     [,21]
[1,] 1.648837 -2.018833 1.175379 1.53502 0.7206189 -0.06904537 -1.373587
[2,] 1.648837 -2.018833 1.175379 1.53502 0.7206189 -0.06904537 -1.373587
          [,22]     [,23]    [,24]     [,25]      [,26]    [,27]      [,28]
[1,] -0.6100907 0.3163685 1.166967 0.6075458 -0.9137106 1.544243 -0.4756454
[2,] -0.6100907 0.3163685 1.166967 0.6075458 -0.9137106 1.544243 -0.4756454
         [,29]    [,30]     [,31]       [,32]     [,33]     [,34]     [,35]
[1,] 0.7268936 1.919101 0.3194203 -0.04133415 0.1495576 -1.837227 0.2980314
[2,] 0.7268936 1.919101 0.3194203 -0.04133415 0.1495576 -1.837227 0.2980314
         [,36]     [,37]    [,38]      [,39]      [,40]     [,41]     [,42]
[1,] 0.9673387 -1.505538 1.053724 -0.8320616 -0.6348909 0.2786741 0.1939762
[2,] 0.9673387 -1.505538 1.053724 -0.8320616 -0.6348909 0.2786741 0.1939762
         [,43]    [,44]    [,45]     [,46]     [,47]       [,48]      [,49]
[1,] 0.9477837 0.994311 2.336277 0.7896215 0.1793512 -0.06429374 -0.8975961
[2,] 0.9477837 0.994311 2.336277 0.7896215 0.1793512 -0.06429374 -0.8975961
         [,50]     [,51]    [,52]    [,53]      [,54]     [,55]   [,56]
[1,] -1.101553 -1.060108 1.960016 1.552413 -0.1397562 0.6783559 1.17323
[2,] -1.101553 -1.060108 1.960016 1.552413 -0.1397562 0.6783559 1.17323
         [,57]     [,58]     [,59]      [,60]      [,61]     [,62]     [,63]
[1,] 0.5185022 0.8954782 0.4128934 -0.2276167 -0.1080451 -2.070263 -1.447085
[2,] 0.5185022 0.8954782 0.4128934 -0.2276167 -0.1080451 -2.070263 -1.447085
          [,64]     [,65]      [,66]      [,67]     [,68]     [,69]     [,70]
[1,] -0.1758287 -2.112327 -0.9950771 -0.7921032 0.6842537 0.2093708 -2.958178
[2,] -0.1758287 -2.112327 -0.9950771 -0.7921032 0.6842537 0.2093708 -2.958178
             [,71]      [,72]      [,73]     [,74]     [,75]      [,76]
[1,] -0.0008490057 -0.9679108 -0.5477978 -1.671008 0.4973721 -0.8483982
[2,] -0.0008490057 -0.9679108 -0.5477978 -1.671008 0.4973721 -0.8483982
         [,77]      [,78]      [,79]      [,80]       [,81]      [,82]
[1,] 0.3348772 -0.2002163 -0.2851429 0.06046231 -0.05153237 -0.5483315
[2,] 0.3348772 -0.2002163 -0.2851429 0.06046231 -0.05153237 -0.5483315
          [,83]      [,84]     [,85]     [,86]       [,87]    [,88]      [,89]
[1,] -0.1756486 -0.4221691 0.2296195 -1.184594 -0.01233549 0.279224 -0.4916247
[2,] -0.1756486 -0.4221691 0.2296195 -1.184594 -0.01233549 0.279224 -0.4916247
         [,90]     [,91]    [,92]     [,93]      [,94]    [,95]     [,96]
[1,] 0.3286666 0.3857465 0.673927 0.3266892 -0.2322819 1.239133 -1.109264
[2,] 0.3286666 0.3857465 0.673927 0.3266892 -0.2322819 1.239133 -1.109264
         [,97]     [,98]     [,99]     [,100]
[1,] -1.257236 -0.523675 -1.007747 -0.9032675
[2,] -1.257236 -0.523675 -1.007747 -0.9032675
> 
> 
> Max(tmp2)
[1] 2.902248
> Min(tmp2)
[1] -2.932855
> mean(tmp2)
[1] 0.01432395
> Sum(tmp2)
[1] 1.432395
> Var(tmp2)
[1] 0.8339915
> 
> rowMeans(tmp2)
  [1] -0.459284838  0.750525928 -0.485726798 -0.386536976 -0.344389267
  [6] -1.111621590  0.324256156 -0.415482636  0.289933204 -0.265410830
 [11]  0.484150906 -1.388632197  0.234516603  1.462334779 -1.373693345
 [16] -1.197282757 -0.519558894  1.904413733  1.164541699 -1.023092992
 [21]  0.594696347 -0.986951868 -1.032098706  0.630368631 -0.339409334
 [26] -0.592556884  0.382575642  0.677890925 -0.471765007 -0.792215859
 [31] -0.295914767 -0.559557500 -0.903640105 -0.576720187  0.538285317
 [36]  0.120255548  0.821049648  1.370497254  0.688425661  1.070390390
 [41] -0.442931693 -0.218595393 -2.932855265  0.290106856 -0.682577330
 [46]  0.216434478 -1.288634127  2.506488333  0.381104961 -0.093695930
 [51] -0.636887005  0.973309753 -0.230798966  0.907791412  0.086375163
 [56] -0.309180092 -0.478484929  0.887341797 -0.002841889  0.839819508
 [61] -0.222806166 -0.320153386  2.902247828  0.601834204  0.368945088
 [66]  1.053907794 -0.239431638  0.157214363 -0.854815947  0.689679050
 [71] -0.020617979 -0.865371960 -0.235282091 -0.118047091 -1.886420088
 [76] -0.327626873 -0.046391142  0.851612203 -0.084339573 -1.107922114
 [81] -0.606212637 -1.677679629  1.180292307 -0.357317456 -0.067270528
 [86] -0.165960955  0.829958089 -0.589948733  1.023248490 -0.292203181
 [91]  0.586122366  0.155865243  0.790850672 -0.874378684 -0.437898380
 [96]  0.767319863 -0.596017821  1.136330497  1.997962175  0.574264080
> rowSums(tmp2)
  [1] -0.459284838  0.750525928 -0.485726798 -0.386536976 -0.344389267
  [6] -1.111621590  0.324256156 -0.415482636  0.289933204 -0.265410830
 [11]  0.484150906 -1.388632197  0.234516603  1.462334779 -1.373693345
 [16] -1.197282757 -0.519558894  1.904413733  1.164541699 -1.023092992
 [21]  0.594696347 -0.986951868 -1.032098706  0.630368631 -0.339409334
 [26] -0.592556884  0.382575642  0.677890925 -0.471765007 -0.792215859
 [31] -0.295914767 -0.559557500 -0.903640105 -0.576720187  0.538285317
 [36]  0.120255548  0.821049648  1.370497254  0.688425661  1.070390390
 [41] -0.442931693 -0.218595393 -2.932855265  0.290106856 -0.682577330
 [46]  0.216434478 -1.288634127  2.506488333  0.381104961 -0.093695930
 [51] -0.636887005  0.973309753 -0.230798966  0.907791412  0.086375163
 [56] -0.309180092 -0.478484929  0.887341797 -0.002841889  0.839819508
 [61] -0.222806166 -0.320153386  2.902247828  0.601834204  0.368945088
 [66]  1.053907794 -0.239431638  0.157214363 -0.854815947  0.689679050
 [71] -0.020617979 -0.865371960 -0.235282091 -0.118047091 -1.886420088
 [76] -0.327626873 -0.046391142  0.851612203 -0.084339573 -1.107922114
 [81] -0.606212637 -1.677679629  1.180292307 -0.357317456 -0.067270528
 [86] -0.165960955  0.829958089 -0.589948733  1.023248490 -0.292203181
 [91]  0.586122366  0.155865243  0.790850672 -0.874378684 -0.437898380
 [96]  0.767319863 -0.596017821  1.136330497  1.997962175  0.574264080
> 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.459284838  0.750525928 -0.485726798 -0.386536976 -0.344389267
  [6] -1.111621590  0.324256156 -0.415482636  0.289933204 -0.265410830
 [11]  0.484150906 -1.388632197  0.234516603  1.462334779 -1.373693345
 [16] -1.197282757 -0.519558894  1.904413733  1.164541699 -1.023092992
 [21]  0.594696347 -0.986951868 -1.032098706  0.630368631 -0.339409334
 [26] -0.592556884  0.382575642  0.677890925 -0.471765007 -0.792215859
 [31] -0.295914767 -0.559557500 -0.903640105 -0.576720187  0.538285317
 [36]  0.120255548  0.821049648  1.370497254  0.688425661  1.070390390
 [41] -0.442931693 -0.218595393 -2.932855265  0.290106856 -0.682577330
 [46]  0.216434478 -1.288634127  2.506488333  0.381104961 -0.093695930
 [51] -0.636887005  0.973309753 -0.230798966  0.907791412  0.086375163
 [56] -0.309180092 -0.478484929  0.887341797 -0.002841889  0.839819508
 [61] -0.222806166 -0.320153386  2.902247828  0.601834204  0.368945088
 [66]  1.053907794 -0.239431638  0.157214363 -0.854815947  0.689679050
 [71] -0.020617979 -0.865371960 -0.235282091 -0.118047091 -1.886420088
 [76] -0.327626873 -0.046391142  0.851612203 -0.084339573 -1.107922114
 [81] -0.606212637 -1.677679629  1.180292307 -0.357317456 -0.067270528
 [86] -0.165960955  0.829958089 -0.589948733  1.023248490 -0.292203181
 [91]  0.586122366  0.155865243  0.790850672 -0.874378684 -0.437898380
 [96]  0.767319863 -0.596017821  1.136330497  1.997962175  0.574264080
> rowMin(tmp2)
  [1] -0.459284838  0.750525928 -0.485726798 -0.386536976 -0.344389267
  [6] -1.111621590  0.324256156 -0.415482636  0.289933204 -0.265410830
 [11]  0.484150906 -1.388632197  0.234516603  1.462334779 -1.373693345
 [16] -1.197282757 -0.519558894  1.904413733  1.164541699 -1.023092992
 [21]  0.594696347 -0.986951868 -1.032098706  0.630368631 -0.339409334
 [26] -0.592556884  0.382575642  0.677890925 -0.471765007 -0.792215859
 [31] -0.295914767 -0.559557500 -0.903640105 -0.576720187  0.538285317
 [36]  0.120255548  0.821049648  1.370497254  0.688425661  1.070390390
 [41] -0.442931693 -0.218595393 -2.932855265  0.290106856 -0.682577330
 [46]  0.216434478 -1.288634127  2.506488333  0.381104961 -0.093695930
 [51] -0.636887005  0.973309753 -0.230798966  0.907791412  0.086375163
 [56] -0.309180092 -0.478484929  0.887341797 -0.002841889  0.839819508
 [61] -0.222806166 -0.320153386  2.902247828  0.601834204  0.368945088
 [66]  1.053907794 -0.239431638  0.157214363 -0.854815947  0.689679050
 [71] -0.020617979 -0.865371960 -0.235282091 -0.118047091 -1.886420088
 [76] -0.327626873 -0.046391142  0.851612203 -0.084339573 -1.107922114
 [81] -0.606212637 -1.677679629  1.180292307 -0.357317456 -0.067270528
 [86] -0.165960955  0.829958089 -0.589948733  1.023248490 -0.292203181
 [91]  0.586122366  0.155865243  0.790850672 -0.874378684 -0.437898380
 [96]  0.767319863 -0.596017821  1.136330497  1.997962175  0.574264080
> 
> colMeans(tmp2)
[1] 0.01432395
> colSums(tmp2)
[1] 1.432395
> colVars(tmp2)
[1] 0.8339915
> colSd(tmp2)
[1] 0.9132313
> colMax(tmp2)
[1] 2.902248
> colMin(tmp2)
[1] -2.932855
> colMedians(tmp2)
[1] -0.1058715
> colRanges(tmp2)
          [,1]
[1,] -2.932855
[2,]  2.902248
> 
> 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]  3.2299792  3.6827812  5.5056680  1.1611501  1.3315201  1.6405146
 [7] -2.7579670  6.6151358 -0.7411873  3.9880066
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.48421911
[2,]  0.02328631
[3,]  0.46491302
[4,]  1.07636300
[5,]  1.32744728
> 
> rowApply(tmp,sum)
 [1] -0.3490820  4.3139793  5.8434829 -0.2264226  1.9022795  4.4617592
 [7]  1.4264619  0.5683988  3.0202025  2.6945417
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    1    3   10    7    1    4    8    9     5
 [2,]    1   10    2    5    3    9    1   10   10     6
 [3,]    8    9    9    6    5    3    9    6    5     8
 [4,]    2    5    1    8    1    8    8    2    6     9
 [5,]    6    3    8    1    8    4    2    7    8    10
 [6,]    4    2    5    7    9   10    3    4    2     2
 [7,]    7    6    4    3    6    2    5    1    1     4
 [8,]    5    8    7    9   10    5   10    5    4     7
 [9,]    3    4    6    2    2    7    7    9    3     1
[10,]    9    7   10    4    4    6    6    3    7     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.02201548 -2.46824858 -2.23007712  1.84180850 -2.90238755  2.67216635
 [7]  2.46200738 -1.23534619  0.08477978  1.55722667 -1.23290789  3.91828661
[13] -1.42866823  3.30271743 -1.68877245 -0.98719889  3.08792067  0.49509653
[19]  1.24588006 -1.76879722
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.76693098
[2,]  0.01003249
[3,]  0.16740266
[4,]  0.58709249
[5,]  1.02441883
> 
> rowApply(tmp,sum)
[1]  0.2001266 -0.6684293  8.1066441 -2.0996334  0.2087934
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    5   15    6   11   17
[2,]    8   12    5    2   11
[3,]   20    7    8    1    5
[4,]    9    9    7   15   20
[5,]   10    1   15    4    4
> 
> 
> as.matrix(tmp)
            [,1]        [,2]       [,3]         [,4]       [,5]       [,6]
[1,] -0.76693098 -0.42578203  1.8593907 -0.326451040 -0.3231693 -0.4708931
[2,]  0.58709249  0.36280742 -0.5099476  0.004546392 -1.6933396  1.5991475
[3,]  0.01003249 -0.25779002  0.1223678  0.010252886  1.0133850 -0.5463674
[4,]  0.16740266 -2.20553211 -2.9507026  0.556405785 -1.0483490  0.7842144
[5,]  1.02441883  0.05804816 -0.7511854  1.597054476 -0.8509146  1.3060649
           [,7]       [,8]       [,9]      [,10]      [,11]       [,12]
[1,]  0.1502556  1.0239821  0.8737005  0.6702871 -0.9449865  0.46575519
[2,]  0.6447218 -1.6246714 -0.8871998 -0.4650789  1.9532455  0.72652393
[3,]  0.3146337  1.5441658  1.1571466  1.4180498 -1.0816357  2.17342620
[4,]  1.6427027 -0.9600824  0.2368986  1.0583158 -1.4283057 -0.02877397
[5,] -0.2903064 -1.2187403 -1.2957662 -1.1243471  0.2687746  0.58135526
          [,13]      [,14]      [,15]      [,16]       [,17]      [,18]
[1,] -0.8253777  1.1508768 -0.4551649 -1.7370523  1.68268481  0.1133482
[2,] -0.8465502  0.4553135 -1.6717449  0.6279475  0.06133148  0.2637922
[3,] -0.9412202  0.4539309  0.6892583  0.7009333 -0.62589482  0.3573949
[4,]  0.8172246 -0.2176170  0.2793858 -0.1449590  1.64989448  0.4580881
[5,]  0.3672553  1.4602133 -0.5305067 -0.4340684  0.31990472 -0.6975268
          [,19]      [,20]
[1,] -0.2434207 -1.2709260
[2,]  0.4574857 -0.7138522
[3,]  1.0320711  0.5625036
[4,] -0.8674083  0.1015639
[5,]  0.8671522 -0.4480865
> 
> 
> 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.13-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.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  640  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.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  549  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.13-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.01497092 -1.214286 -0.8723593 -1.548518 -1.266891 -0.1713348 -0.8634605
          col8      col9     col10       col11     col12   col13    col14
row1 0.3550915 0.3209907 0.1305177 -0.09909073 0.2555922 1.44523 1.095108
          col15     col16     col17    col18      col19     col20
row1 -0.1737415 0.7698723 -1.322104 1.285581 -0.5441176 0.9972037
> tmp[,"col10"]
           col10
row1  0.13051773
row2 -0.10392839
row3  0.33515714
row4 -0.05359823
row5 -0.68394873
> tmp[c("row1","row5"),]
            col1       col2        col3      col4       col5       col6
row1  0.01497092 -1.2142862 -0.87235934 -1.548518 -1.2668911 -0.1713348
row5 -0.70203849  0.9649253  0.06186075  1.681426 -0.2724239  0.1283039
           col7       col8       col9      col10       col11     col12    col13
row1 -0.8634605 0.35509147  0.3209907  0.1305177 -0.09909073 0.2555922 1.445230
row5  2.2280883 0.07619185 -0.9666862 -0.6839487 -0.12102079 1.2132561 1.075014
         col14      col15      col16     col17    col18      col19     col20
row1  1.095108 -0.1737415  0.7698723 -1.322104 1.285581 -0.5441176 0.9972037
row5 -1.087368 -1.2668302 -1.7970715 -1.568385 1.130248 -1.0319130 1.1076554
> tmp[,c("col6","col20")]
            col6       col20
row1 -0.17133484  0.99720368
row2 -0.52400969  0.09778323
row3 -0.12176634 -0.14612107
row4  0.09576932  0.56287477
row5  0.12830395  1.10765540
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -0.1713348 0.9972037
row5  0.1283039 1.1076554
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.33435 49.79158 49.99019 50.95634 50.43928 104.6309 49.97516 49.21179
         col9    col10   col11    col12    col13    col14    col15    col16
row1 48.04458 50.28751 49.5727 49.88763 49.77105 49.14976 50.03553 50.09002
       col17    col18    col19    col20
row1 50.2535 50.36756 49.20589 104.8282
> tmp[,"col10"]
        col10
row1 50.28751
row2 30.24661
row3 28.45761
row4 30.91310
row5 49.61837
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.33435 49.79158 49.99019 50.95634 50.43928 104.6309 49.97516 49.21179
row5 50.01853 49.95654 47.97624 50.90571 51.74068 105.8867 50.68276 50.73057
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.04458 50.28751 49.57270 49.88763 49.77105 49.14976 50.03553 50.09002
row5 51.95328 49.61837 49.92034 50.52902 50.65070 52.59777 50.52210 51.32623
        col17    col18    col19    col20
row1 50.25350 50.36756 49.20589 104.8282
row5 50.24411 49.79270 49.09441 106.6193
> tmp[,c("col6","col20")]
          col6     col20
row1 104.63087 104.82820
row2  75.12681  75.65947
row3  74.28947  75.58772
row4  74.77384  76.75751
row5 105.88668 106.61929
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.6309 104.8282
row5 105.8867 106.6193
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.6309 104.8282
row5 105.8867 106.6193
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.2529571
[2,]  0.6662293
[3,]  0.5788226
[4,] -1.1947176
[5,]  0.9718349
> tmp[,c("col17","col7")]
           col17       col7
[1,] -2.03525459  0.7783711
[2,]  0.06454483 -1.4831236
[3,]  1.49340682 -0.6614458
[4,]  0.70098600  1.7600674
[5,] -0.02861509 -0.3390379
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.5063740 -0.4758445
[2,]  0.4181958  0.1850712
[3,]  0.5128238 -0.8975972
[4,]  0.7431411  0.6272666
[5,] -0.0216570 -0.7019472
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -0.506374
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.5063740
[2,]  0.4181958
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]       [,5]       [,6]      [,7]
row3 -0.1927414  0.6255873 0.6706920 0.04985099  0.1349279 -0.2217587 -1.304488
row1  1.2995952 -1.0561779 0.7019986 0.84591613 -0.4599499 -1.0030122 -0.352546
           [,8]       [,9]       [,10]      [,11]       [,12]      [,13]
row3 -0.5411637 -0.7798136 -0.03234898  0.5609988  0.05297872 -0.2584116
row1  0.0627374 -0.4629697 -0.91365450 -0.6531546 -1.94376276 -1.4067876
         [,14]      [,15]       [,16]      [,17]      [,18]     [,19]
row3 -1.550110  0.5124765  0.07493072 -0.1958771  0.4348926  1.931056
row1 -1.033714 -0.5426949 -0.42194501 -0.3156500 -1.8859628 -1.212884
           [,20]
row3 -0.02007186
row1  0.07953666
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]    [,3]       [,4]       [,5]        [,6]      [,7]
row2 0.442303 0.6831472 1.15023 0.05190265 -0.1905737 -0.01316271 0.8297985
           [,8]       [,9]     [,10]
row2 0.06369043 -0.3041375 0.2371334
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]       [,4]     [,5]       [,6]      [,7]
row5 0.4500488 -1.466985 0.8803412 -0.7176589 1.062843 -0.2198679 -1.348544
           [,8]     [,9]     [,10]     [,11]     [,12]     [,13]    [,14]
row5 -0.2989396 1.462258 -1.082832 -1.366828 -1.648989 0.2144462 1.353907
           [,15]     [,16]     [,17]     [,18]     [,19]    [,20]
row5 -0.06089805 0.2500398 -1.717735 -1.946186 -0.577143 -1.00232
> 
> 
> 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: 0x02edf8b8>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e845ea12f3"
 [2] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e845e11c91"
 [3] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e84351e52" 
 [4] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e82a782714"
 [5] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e861782f73"
 [6] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e876737d3a"
 [7] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e837d33f77"
 [8] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e84f8c4038"
 [9] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e818c713e" 
[10] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e86ec9323" 
[11] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e89802c4"  
[12] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e8ca316f1" 
[13] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e8178b8b1" 
[14] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e8586752a0"
[15] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17e84305182b"
> 
> 
> ### 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: 0x020f54f0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x020f54f0>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.13-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x020f54f0>
> rowMedians(tmp)
  [1] -0.1754725305  0.4462039481  0.3195771408  0.1151937435  0.4769301517
  [6] -0.2739067910  0.5325936254 -0.1302364476  0.0130763755 -0.2458427971
 [11]  0.6651885630 -0.0388918239  0.2061137942  0.2904596504 -0.4555535840
 [16] -0.5538197689  0.3183020297 -0.2261618889  0.1144203295  0.1357338852
 [21] -0.0199614024  0.1560818002 -0.1596942769 -0.0624525284  0.5997906375
 [26]  0.3891853857  0.0979756300  0.0007678650 -0.2833274840  0.0386625634
 [31] -0.3443006016 -0.2898641788 -0.2670218233  0.2079076408 -0.2000286694
 [36] -0.4108077622  0.0540642294  0.0987676277 -0.1008097438  0.0983397868
 [41] -0.2229167621 -0.0953278317  0.0236605520  0.1614976960 -0.4606988248
 [46]  0.0992586114 -0.4790973417  0.1694426581 -0.0812062217 -0.1255330573
 [51] -0.3802018694 -0.0033699307 -0.5335065297  0.5398028786  0.1585626655
 [56] -0.2506933428 -0.0457420934 -0.4100669443 -0.4203771113 -0.0792502848
 [61]  0.4307015161 -0.4569409407  0.2993910081  0.0873487338  0.3369678737
 [66] -0.0364263878 -0.0119289667 -0.1305611576  0.3343590179  0.1116285467
 [71]  0.2302488819  0.0214384927 -0.1540582047  1.0524259155 -0.4443006427
 [76] -0.2415044517 -0.5645626504 -0.0727189661 -0.1007535981 -0.5140419965
 [81] -0.4912604545  0.5750969599  0.1929234831 -0.1422835829  0.2695951089
 [86] -0.1238194004 -0.1767539672  0.0574558664 -0.0038393728  0.2212246304
 [91]  0.1499891878 -0.0695683617  0.3179283379  0.4311469352 -0.0443922008
 [96]  0.2759059091 -0.3095211208  0.0012169434 -0.2408482897  0.0721263048
[101] -0.2478998866 -0.1685919370  0.4067268104 -0.0249687790 -0.1894836699
[106]  0.3466987202  0.0884472079 -0.0569655299 -0.4022914906 -0.2462817022
[111] -0.4312890988 -0.6667034590 -0.1671446757 -0.1667974603 -0.3841016507
[116]  0.2224314551  0.3842987172  0.0270173751 -0.0014932053  0.0703443666
[121] -0.0241788047 -0.0350975344 -0.2519983262 -0.0017863380 -0.2510156609
[126]  0.1320767353  0.2026276239  0.4385717146  0.0194364476  0.4103798840
[131] -0.2725922652  0.2210422132 -0.2542664433 -0.0062384869  0.2629350474
[136] -0.0123883522 -0.0525239016 -0.2152046145 -0.1917594574 -0.1716866182
[141]  0.6527775063  0.4387123879  0.0567175415 -0.0001637879 -0.0769683290
[146]  0.3418274321  0.0046281547  0.2726080865  0.2922123977  0.1038506608
[151]  0.1184931288 -0.2800227980  0.3838218961  0.2782947570 -0.0679200395
[156]  0.1265816308  0.3747977365 -0.5557796168 -0.0359621759 -0.1619775044
[161] -0.3429895372 -0.1465726031  0.2192149363 -0.1592980164  0.7114533126
[166]  0.1502485517  0.2001593398  0.1871841193 -0.6022944898 -0.3729151026
[171]  0.1956509526  0.0625388584 -0.3265097158  0.3538311157  0.2280320728
[176]  0.0956619882 -0.2411305318  0.3795005771  0.3124534182  0.1689424204
[181]  0.0833712361 -0.1716322373 -0.2812892199  0.2049856756  0.2315698627
[186]  0.2025784341 -0.5719495616 -0.0470030515  0.0267896496  0.2190747791
[191] -0.1247153912 -0.4719030572 -0.0514710901 -0.0022164894 -0.2360491575
[196]  0.4562876617 -0.1885762826  0.6370976144  0.4136226317 -0.1627103735
[201]  0.3030303301  0.6671490284  0.0590331875  0.1171779199 -0.4793906240
[206]  0.2846547449  0.0051816580  0.6880696369  0.9271778696 -0.4065587066
[211] -0.5371036496 -0.7840938678  0.4562477344  0.2097489525 -0.3277936500
[216]  0.1259377562  0.4080943338 -0.8109666308  0.2044135660  0.3275765436
[221]  0.0432563925  0.3952863644 -0.0999571320  0.1628577679  0.2334299005
[226]  0.5830244003 -0.1484620519 -0.2558180813 -0.0607058570  0.1008066679
> 
> proc.time()
   user  system elapsed 
   2.96    7.31   10.43 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "C:/Users/biocbuild/bbs-3.13-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 436479 23.4     923334 49.4   647497 34.6
Vcells 756611  5.8    8388608 64.0  1965424 15.0
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Oct 14 20:29:35 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Oct 14 20:29:35 2021"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x0000000006f35930>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Oct 14 20:29:38 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Oct 14 20:29:39 2021"
> 
> ColMode(tmp2)
<pointer: 0x0000000006f35930>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]      [,2]        [,3]        [,4]
[1,] 99.3521701 1.7624177 -0.03417708  0.08859713
[2,]  1.1037884 0.3835711  1.09301831 -0.47167898
[3,]  0.4157516 0.6276918  0.84952062  1.00201412
[4,]  0.4132148 0.4475044  0.90714960 -1.28449744
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]       [,3]       [,4]
[1,] 99.3521701 1.7624177 0.03417708 0.08859713
[2,]  1.1037884 0.3835711 1.09301831 0.47167898
[3,]  0.4157516 0.6276918 0.84952062 1.00201412
[4,]  0.4132148 0.4475044 0.90714960 1.28449744
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9675559 1.3275608 0.1848705 0.2976527
[2,] 1.0506133 0.6193312 1.0454752 0.6867889
[3,] 0.6447880 0.7922700 0.9216944 1.0010066
[4,] 0.6428179 0.6689577 0.9524440 1.1333567
> 
> 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.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2.1  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.02773 40.03803 26.88288 28.06512
[2,]  36.60992 31.57688 36.54777 32.33957
[3,]  31.86363 33.55039 35.06646 36.01208
[4,]  31.84139 32.13708 35.43159 37.61806
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000005d2c3e0>
> exp(tmp5)
<pointer: 0x0000000005d2c3e0>
> log(tmp5,2)
<pointer: 0x0000000005d2c3e0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.2844
> Min(tmp5)
[1] 54.25374
> mean(tmp5)
[1] 74.25696
> Sum(tmp5)
[1] 14851.39
> Var(tmp5)
[1] 853.5459
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.88862 69.74604 71.24397 74.73882 70.35783 75.34128 73.68023 73.30303
 [9] 69.27298 71.99677
> rowSums(tmp5)
 [1] 1857.772 1394.921 1424.879 1494.776 1407.157 1506.826 1473.605 1466.061
 [9] 1385.460 1439.935
> rowVars(tmp5)
 [1] 7840.47133   51.31765   47.23450   47.70105   86.75298  111.85684
 [7]   94.58806   53.66058   68.62000   90.86451
> rowSd(tmp5)
 [1] 88.546436  7.163634  6.872736  6.906595  9.314128 10.576239  9.725640
 [8]  7.325338  8.283719  9.532288
> rowMax(tmp5)
 [1] 466.28437  83.30266  83.72946  87.10950  89.27607  88.82243  92.02846
 [8]  89.13274  87.16848  86.09795
> rowMin(tmp5)
 [1] 55.95320 59.53969 58.21794 62.31814 56.91018 54.95793 56.57219 59.48685
 [9] 55.59141 54.25374
> 
> colMeans(tmp5)
 [1] 110.99564  72.57616  72.59270  73.30479  76.07744  72.36030  72.36060
 [8]  67.79001  73.00375  70.03794  73.86896  73.92471  72.21979  72.60164
[15]  71.48541  76.13565  67.05245  72.06188  73.40881  71.28049
> colSums(tmp5)
 [1] 1109.9564  725.7616  725.9270  733.0479  760.7744  723.6030  723.6060
 [8]  677.9001  730.0375  700.3794  738.6896  739.2471  722.1979  726.0164
[15]  714.8541  761.3565  670.5245  720.6188  734.0881  712.8049
> colVars(tmp5)
 [1] 15644.92473   129.22845    63.80402    39.05753   148.47554   113.85408
 [7]    62.44515    41.15421    74.03597    92.88758    62.98265   142.42852
[13]    85.28443    77.80475    25.76666   100.45191    36.84690    87.77347
[19]    72.78221    90.19743
> colSd(tmp5)
 [1] 125.079674  11.367869   7.987742   6.249603  12.185054  10.670243
 [7]   7.902224   6.415155   8.604416   9.637820   7.936161  11.934342
[13]   9.234957   8.820700   5.076087  10.022570   6.070165   9.368750
[19]   8.531249   9.497233
> colMax(tmp5)
 [1] 466.28437  89.13274  82.27266  79.72361  89.17303  87.16848  83.06541
 [8]  78.83099  84.61861  84.53975  83.72946  85.01431  89.04314  84.12729
[15]  82.07156  92.02846  78.08193  89.27607  86.09795  90.63698
> colMin(tmp5)
 [1] 62.12115 54.25374 55.95320 58.41388 58.38722 54.95793 60.47598 59.67427
 [9] 62.08941 57.97166 64.09704 55.59141 58.60633 56.57219 65.91597 60.04672
[17] 58.16787 59.76575 62.31814 62.85152
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.88862 69.74604 71.24397 74.73882 70.35783       NA 73.68023 73.30303
 [9] 69.27298 71.99677
> rowSums(tmp5)
 [1] 1857.772 1394.921 1424.879 1494.776 1407.157       NA 1473.605 1466.061
 [9] 1385.460 1439.935
> rowVars(tmp5)
 [1] 7840.47133   51.31765   47.23450   47.70105   86.75298  111.40590
 [7]   94.58806   53.66058   68.62000   90.86451
> rowSd(tmp5)
 [1] 88.546436  7.163634  6.872736  6.906595  9.314128 10.554899  9.725640
 [8]  7.325338  8.283719  9.532288
> rowMax(tmp5)
 [1] 466.28437  83.30266  83.72946  87.10950  89.27607        NA  92.02846
 [8]  89.13274  87.16848  86.09795
> rowMin(tmp5)
 [1] 55.95320 59.53969 58.21794 62.31814 56.91018       NA 56.57219 59.48685
 [9] 55.59141 54.25374
> 
> colMeans(tmp5)
 [1] 110.99564  72.57616  72.59270  73.30479  76.07744  72.36030  72.36060
 [8]  67.79001  73.00375  70.03794  73.86896  73.92471        NA  72.60164
[15]  71.48541  76.13565  67.05245  72.06188  73.40881  71.28049
> colSums(tmp5)
 [1] 1109.9564  725.7616  725.9270  733.0479  760.7744  723.6030  723.6060
 [8]  677.9001  730.0375  700.3794  738.6896  739.2471        NA  726.0164
[15]  714.8541  761.3565  670.5245  720.6188  734.0881  712.8049
> colVars(tmp5)
 [1] 15644.92473   129.22845    63.80402    39.05753   148.47554   113.85408
 [7]    62.44515    41.15421    74.03597    92.88758    62.98265   142.42852
[13]          NA    77.80475    25.76666   100.45191    36.84690    87.77347
[19]    72.78221    90.19743
> colSd(tmp5)
 [1] 125.079674  11.367869   7.987742   6.249603  12.185054  10.670243
 [7]   7.902224   6.415155   8.604416   9.637820   7.936161  11.934342
[13]         NA   8.820700   5.076087  10.022570   6.070165   9.368750
[19]   8.531249   9.497233
> colMax(tmp5)
 [1] 466.28437  89.13274  82.27266  79.72361  89.17303  87.16848  83.06541
 [8]  78.83099  84.61861  84.53975  83.72946  85.01431        NA  84.12729
[15]  82.07156  92.02846  78.08193  89.27607  86.09795  90.63698
> colMin(tmp5)
 [1] 62.12115 54.25374 55.95320 58.41388 58.38722 54.95793 60.47598 59.67427
 [9] 62.08941 57.97166 64.09704 55.59141       NA 56.57219 65.91597 60.04672
[17] 58.16787 59.76575 62.31814 62.85152
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.2844
> Min(tmp5,na.rm=TRUE)
[1] 54.25374
> mean(tmp5,na.rm=TRUE)
[1] 74.30516
> Sum(tmp5,na.rm=TRUE)
[1] 14786.73
> Var(tmp5,na.rm=TRUE)
[1] 857.3898
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.88862 69.74604 71.24397 74.73882 70.35783 75.90317 73.68023 73.30303
 [9] 69.27298 71.99677
> rowSums(tmp5,na.rm=TRUE)
 [1] 1857.772 1394.921 1424.879 1494.776 1407.157 1442.160 1473.605 1466.061
 [9] 1385.460 1439.935
> rowVars(tmp5,na.rm=TRUE)
 [1] 7840.47133   51.31765   47.23450   47.70105   86.75298  111.40590
 [7]   94.58806   53.66058   68.62000   90.86451
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.546436  7.163634  6.872736  6.906595  9.314128 10.554899  9.725640
 [8]  7.325338  8.283719  9.532288
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.28437  83.30266  83.72946  87.10950  89.27607  88.82243  92.02846
 [8]  89.13274  87.16848  86.09795
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.95320 59.53969 58.21794 62.31814 56.91018 54.95793 56.57219 59.48685
 [9] 55.59141 54.25374
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.99564  72.57616  72.59270  73.30479  76.07744  72.36030  72.36060
 [8]  67.79001  73.00375  70.03794  73.86896  73.92471  73.05917  72.60164
[15]  71.48541  76.13565  67.05245  72.06188  73.40881  71.28049
> colSums(tmp5,na.rm=TRUE)
 [1] 1109.9564  725.7616  725.9270  733.0479  760.7744  723.6030  723.6060
 [8]  677.9001  730.0375  700.3794  738.6896  739.2471  657.5325  726.0164
[15]  714.8541  761.3565  670.5245  720.6188  734.0881  712.8049
> colVars(tmp5,na.rm=TRUE)
 [1] 15644.92473   129.22845    63.80402    39.05753   148.47554   113.85408
 [7]    62.44515    41.15421    74.03597    92.88758    62.98265   142.42852
[13]    88.01871    77.80475    25.76666   100.45191    36.84690    87.77347
[19]    72.78221    90.19743
> colSd(tmp5,na.rm=TRUE)
 [1] 125.079674  11.367869   7.987742   6.249603  12.185054  10.670243
 [7]   7.902224   6.415155   8.604416   9.637820   7.936161  11.934342
[13]   9.381829   8.820700   5.076087  10.022570   6.070165   9.368750
[19]   8.531249   9.497233
> colMax(tmp5,na.rm=TRUE)
 [1] 466.28437  89.13274  82.27266  79.72361  89.17303  87.16848  83.06541
 [8]  78.83099  84.61861  84.53975  83.72946  85.01431  89.04314  84.12729
[15]  82.07156  92.02846  78.08193  89.27607  86.09795  90.63698
> colMin(tmp5,na.rm=TRUE)
 [1] 62.12115 54.25374 55.95320 58.41388 58.38722 54.95793 60.47598 59.67427
 [9] 62.08941 57.97166 64.09704 55.59141 58.60633 56.57219 65.91597 60.04672
[17] 58.16787 59.76575 62.31814 62.85152
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.88862 69.74604 71.24397 74.73882 70.35783      NaN 73.68023 73.30303
 [9] 69.27298 71.99677
> rowSums(tmp5,na.rm=TRUE)
 [1] 1857.772 1394.921 1424.879 1494.776 1407.157    0.000 1473.605 1466.061
 [9] 1385.460 1439.935
> rowVars(tmp5,na.rm=TRUE)
 [1] 7840.47133   51.31765   47.23450   47.70105   86.75298         NA
 [7]   94.58806   53.66058   68.62000   90.86451
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.546436  7.163634  6.872736  6.906595  9.314128        NA  9.725640
 [8]  7.325338  8.283719  9.532288
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.28437  83.30266  83.72946  87.10950  89.27607        NA  92.02846
 [8]  89.13274  87.16848  86.09795
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.95320 59.53969 58.21794 62.31814 56.91018       NA 56.57219 59.48685
 [9] 55.59141 54.25374
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.08414  70.77102  71.95530  72.59159  74.72920  74.29389  71.17118
 [8]  68.69176  72.20603  68.96356  72.97534  75.68091       NaN  72.54131
[15]  71.21103  75.16252  67.36880  70.88690  72.29065  72.09522
> colSums(tmp5,na.rm=TRUE)
 [1] 1026.7573  636.9392  647.5977  653.3243  672.5628  668.6450  640.5406
 [8]  618.2259  649.8543  620.6720  656.7781  681.1282    0.0000  652.8718
[15]  640.8993  676.4626  606.3192  637.9821  650.6158  648.8570
> colVars(tmp5,na.rm=TRUE)
 [1] 17493.22845   108.72349    67.20879    38.21733   146.58517    86.02440
 [7]    54.33513    37.15052    76.13145    91.51257    61.87168   125.53446
[13]          NA    87.48940    28.14056   102.35483    40.32690    83.21389
[19]    67.81419    94.00447
> colSd(tmp5,na.rm=TRUE)
 [1] 132.261969  10.427056   8.198096   6.182017  12.107236   9.274934
 [7]   7.371236   6.095123   8.725334   9.566220   7.865855  11.204216
[13]         NA   9.353577   5.304767  10.117056   6.350346   9.122165
[19]   8.234937   9.695590
> colMax(tmp5,na.rm=TRUE)
 [1] 466.28437  89.13274  82.27266  78.29707  89.17303  87.16848  82.41234
 [8]  78.83099  84.61861  84.53975  83.72946  85.01431      -Inf  84.12729
[15]  82.07156  92.02846  78.08193  89.27607  86.09795  90.63698
> colMin(tmp5,na.rm=TRUE)
 [1] 62.12115 54.25374 55.95320 58.41388 58.38722 56.91018 60.47598 60.89951
 [9] 62.08941 57.97166 64.09704 55.59141      Inf 56.57219 65.91597 60.04672
[17] 58.16787 59.76575 62.31814 62.85152
> 
> 
> 
> 
> 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] 266.1474 317.1682 289.9741 245.0470 177.1730 180.9033 152.1379 169.1083
 [9] 247.3449 109.7263
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 266.1474 317.1682 289.9741 245.0470 177.1730 180.9033 152.1379 169.1083
 [9] 247.3449 109.7263
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.136868e-13 -2.842171e-14  2.842171e-14  5.684342e-14 -1.421085e-13
 [6] -4.263256e-14 -5.684342e-14 -2.842171e-14  2.273737e-13  7.105427e-14
[11]  2.273737e-13  2.842171e-14 -2.842171e-14  0.000000e+00  0.000000e+00
[16] -2.842171e-13 -1.136868e-13  5.684342e-14  8.526513e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   14 
1   4 
5   2 
6   8 
6   13 
9   10 
4   7 
3   7 
2   15 
3   1 
5   9 
3   6 
8   6 
9   8 
6   4 
6   11 
5   12 
9   17 
4   1 
6   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.935196
> Min(tmp)
[1] -2.761901
> mean(tmp)
[1] -0.0003193774
> Sum(tmp)
[1] -0.03193774
> Var(tmp)
[1] 0.9581773
> 
> rowMeans(tmp)
[1] -0.0003193774
> rowSums(tmp)
[1] -0.03193774
> rowVars(tmp)
[1] 0.9581773
> rowSd(tmp)
[1] 0.9788653
> rowMax(tmp)
[1] 2.935196
> rowMin(tmp)
[1] -2.761901
> 
> colMeans(tmp)
  [1] -0.76460457  0.41424256  0.32879458 -0.76865459  0.94475511 -0.19948267
  [7]  0.83781616 -0.72759284 -0.78856226  0.43228945  1.41455430  0.62987390
 [13] -1.22606947  2.93519601 -1.60419323 -1.50090307 -0.17444528  0.25694969
 [19] -2.54996422  0.28445645 -0.40462947  0.83495986 -0.68126930  1.59721372
 [25]  1.04848501  0.34756835  0.59668468 -1.70263944  0.63634831  1.28694381
 [31]  1.00577153 -1.07406715  0.60063178  0.88568399 -1.20771190 -0.56616376
 [37]  0.14410873  0.17450771  0.46374293  0.54482889  0.18193629 -0.93558285
 [43]  0.02236019  0.66138710 -0.30255664 -1.26011071 -0.64461296 -0.69137058
 [49] -0.23376128  0.07667220  1.67208056  1.22441512 -0.68638918  0.86818905
 [55] -1.08027436  0.53273430 -0.20914472  0.46878506 -1.60497901  0.62227925
 [61] -0.33984403 -1.74606250 -1.05565026  0.10850961  1.73876633 -0.35915162
 [67]  0.44490397 -1.00360441 -0.57711983  1.03102873 -0.50375601 -0.29555656
 [73] -1.33593879  0.20993162  0.70157062  1.78602391 -0.02615414  0.35475428
 [79] -2.76190050  0.03778768  0.50215531 -0.08619014  0.69831461  0.20111161
 [85] -0.42676863  0.27737988  0.91898105  1.50035516  0.09724073  0.67397983
 [91] -0.07217963 -0.61931543  0.21144609 -1.07461097 -0.01570590  0.82736839
 [97] -0.54181547 -1.71963463 -0.60239341  1.42229457
> colSums(tmp)
  [1] -0.76460457  0.41424256  0.32879458 -0.76865459  0.94475511 -0.19948267
  [7]  0.83781616 -0.72759284 -0.78856226  0.43228945  1.41455430  0.62987390
 [13] -1.22606947  2.93519601 -1.60419323 -1.50090307 -0.17444528  0.25694969
 [19] -2.54996422  0.28445645 -0.40462947  0.83495986 -0.68126930  1.59721372
 [25]  1.04848501  0.34756835  0.59668468 -1.70263944  0.63634831  1.28694381
 [31]  1.00577153 -1.07406715  0.60063178  0.88568399 -1.20771190 -0.56616376
 [37]  0.14410873  0.17450771  0.46374293  0.54482889  0.18193629 -0.93558285
 [43]  0.02236019  0.66138710 -0.30255664 -1.26011071 -0.64461296 -0.69137058
 [49] -0.23376128  0.07667220  1.67208056  1.22441512 -0.68638918  0.86818905
 [55] -1.08027436  0.53273430 -0.20914472  0.46878506 -1.60497901  0.62227925
 [61] -0.33984403 -1.74606250 -1.05565026  0.10850961  1.73876633 -0.35915162
 [67]  0.44490397 -1.00360441 -0.57711983  1.03102873 -0.50375601 -0.29555656
 [73] -1.33593879  0.20993162  0.70157062  1.78602391 -0.02615414  0.35475428
 [79] -2.76190050  0.03778768  0.50215531 -0.08619014  0.69831461  0.20111161
 [85] -0.42676863  0.27737988  0.91898105  1.50035516  0.09724073  0.67397983
 [91] -0.07217963 -0.61931543  0.21144609 -1.07461097 -0.01570590  0.82736839
 [97] -0.54181547 -1.71963463 -0.60239341  1.42229457
> 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.76460457  0.41424256  0.32879458 -0.76865459  0.94475511 -0.19948267
  [7]  0.83781616 -0.72759284 -0.78856226  0.43228945  1.41455430  0.62987390
 [13] -1.22606947  2.93519601 -1.60419323 -1.50090307 -0.17444528  0.25694969
 [19] -2.54996422  0.28445645 -0.40462947  0.83495986 -0.68126930  1.59721372
 [25]  1.04848501  0.34756835  0.59668468 -1.70263944  0.63634831  1.28694381
 [31]  1.00577153 -1.07406715  0.60063178  0.88568399 -1.20771190 -0.56616376
 [37]  0.14410873  0.17450771  0.46374293  0.54482889  0.18193629 -0.93558285
 [43]  0.02236019  0.66138710 -0.30255664 -1.26011071 -0.64461296 -0.69137058
 [49] -0.23376128  0.07667220  1.67208056  1.22441512 -0.68638918  0.86818905
 [55] -1.08027436  0.53273430 -0.20914472  0.46878506 -1.60497901  0.62227925
 [61] -0.33984403 -1.74606250 -1.05565026  0.10850961  1.73876633 -0.35915162
 [67]  0.44490397 -1.00360441 -0.57711983  1.03102873 -0.50375601 -0.29555656
 [73] -1.33593879  0.20993162  0.70157062  1.78602391 -0.02615414  0.35475428
 [79] -2.76190050  0.03778768  0.50215531 -0.08619014  0.69831461  0.20111161
 [85] -0.42676863  0.27737988  0.91898105  1.50035516  0.09724073  0.67397983
 [91] -0.07217963 -0.61931543  0.21144609 -1.07461097 -0.01570590  0.82736839
 [97] -0.54181547 -1.71963463 -0.60239341  1.42229457
> colMin(tmp)
  [1] -0.76460457  0.41424256  0.32879458 -0.76865459  0.94475511 -0.19948267
  [7]  0.83781616 -0.72759284 -0.78856226  0.43228945  1.41455430  0.62987390
 [13] -1.22606947  2.93519601 -1.60419323 -1.50090307 -0.17444528  0.25694969
 [19] -2.54996422  0.28445645 -0.40462947  0.83495986 -0.68126930  1.59721372
 [25]  1.04848501  0.34756835  0.59668468 -1.70263944  0.63634831  1.28694381
 [31]  1.00577153 -1.07406715  0.60063178  0.88568399 -1.20771190 -0.56616376
 [37]  0.14410873  0.17450771  0.46374293  0.54482889  0.18193629 -0.93558285
 [43]  0.02236019  0.66138710 -0.30255664 -1.26011071 -0.64461296 -0.69137058
 [49] -0.23376128  0.07667220  1.67208056  1.22441512 -0.68638918  0.86818905
 [55] -1.08027436  0.53273430 -0.20914472  0.46878506 -1.60497901  0.62227925
 [61] -0.33984403 -1.74606250 -1.05565026  0.10850961  1.73876633 -0.35915162
 [67]  0.44490397 -1.00360441 -0.57711983  1.03102873 -0.50375601 -0.29555656
 [73] -1.33593879  0.20993162  0.70157062  1.78602391 -0.02615414  0.35475428
 [79] -2.76190050  0.03778768  0.50215531 -0.08619014  0.69831461  0.20111161
 [85] -0.42676863  0.27737988  0.91898105  1.50035516  0.09724073  0.67397983
 [91] -0.07217963 -0.61931543  0.21144609 -1.07461097 -0.01570590  0.82736839
 [97] -0.54181547 -1.71963463 -0.60239341  1.42229457
> colMedians(tmp)
  [1] -0.76460457  0.41424256  0.32879458 -0.76865459  0.94475511 -0.19948267
  [7]  0.83781616 -0.72759284 -0.78856226  0.43228945  1.41455430  0.62987390
 [13] -1.22606947  2.93519601 -1.60419323 -1.50090307 -0.17444528  0.25694969
 [19] -2.54996422  0.28445645 -0.40462947  0.83495986 -0.68126930  1.59721372
 [25]  1.04848501  0.34756835  0.59668468 -1.70263944  0.63634831  1.28694381
 [31]  1.00577153 -1.07406715  0.60063178  0.88568399 -1.20771190 -0.56616376
 [37]  0.14410873  0.17450771  0.46374293  0.54482889  0.18193629 -0.93558285
 [43]  0.02236019  0.66138710 -0.30255664 -1.26011071 -0.64461296 -0.69137058
 [49] -0.23376128  0.07667220  1.67208056  1.22441512 -0.68638918  0.86818905
 [55] -1.08027436  0.53273430 -0.20914472  0.46878506 -1.60497901  0.62227925
 [61] -0.33984403 -1.74606250 -1.05565026  0.10850961  1.73876633 -0.35915162
 [67]  0.44490397 -1.00360441 -0.57711983  1.03102873 -0.50375601 -0.29555656
 [73] -1.33593879  0.20993162  0.70157062  1.78602391 -0.02615414  0.35475428
 [79] -2.76190050  0.03778768  0.50215531 -0.08619014  0.69831461  0.20111161
 [85] -0.42676863  0.27737988  0.91898105  1.50035516  0.09724073  0.67397983
 [91] -0.07217963 -0.61931543  0.21144609 -1.07461097 -0.01570590  0.82736839
 [97] -0.54181547 -1.71963463 -0.60239341  1.42229457
> colRanges(tmp)
           [,1]      [,2]      [,3]       [,4]      [,5]       [,6]      [,7]
[1,] -0.7646046 0.4142426 0.3287946 -0.7686546 0.9447551 -0.1994827 0.8378162
[2,] -0.7646046 0.4142426 0.3287946 -0.7686546 0.9447551 -0.1994827 0.8378162
           [,8]       [,9]     [,10]    [,11]     [,12]     [,13]    [,14]
[1,] -0.7275928 -0.7885623 0.4322895 1.414554 0.6298739 -1.226069 2.935196
[2,] -0.7275928 -0.7885623 0.4322895 1.414554 0.6298739 -1.226069 2.935196
         [,15]     [,16]      [,17]     [,18]     [,19]     [,20]      [,21]
[1,] -1.604193 -1.500903 -0.1744453 0.2569497 -2.549964 0.2844565 -0.4046295
[2,] -1.604193 -1.500903 -0.1744453 0.2569497 -2.549964 0.2844565 -0.4046295
         [,22]      [,23]    [,24]    [,25]     [,26]     [,27]     [,28]
[1,] 0.8349599 -0.6812693 1.597214 1.048485 0.3475684 0.5966847 -1.702639
[2,] 0.8349599 -0.6812693 1.597214 1.048485 0.3475684 0.5966847 -1.702639
         [,29]    [,30]    [,31]     [,32]     [,33]    [,34]     [,35]
[1,] 0.6363483 1.286944 1.005772 -1.074067 0.6006318 0.885684 -1.207712
[2,] 0.6363483 1.286944 1.005772 -1.074067 0.6006318 0.885684 -1.207712
          [,36]     [,37]     [,38]     [,39]     [,40]     [,41]      [,42]
[1,] -0.5661638 0.1441087 0.1745077 0.4637429 0.5448289 0.1819363 -0.9355828
[2,] -0.5661638 0.1441087 0.1745077 0.4637429 0.5448289 0.1819363 -0.9355828
          [,43]     [,44]      [,45]     [,46]     [,47]      [,48]      [,49]
[1,] 0.02236019 0.6613871 -0.3025566 -1.260111 -0.644613 -0.6913706 -0.2337613
[2,] 0.02236019 0.6613871 -0.3025566 -1.260111 -0.644613 -0.6913706 -0.2337613
         [,50]    [,51]    [,52]      [,53]     [,54]     [,55]     [,56]
[1,] 0.0766722 1.672081 1.224415 -0.6863892 0.8681891 -1.080274 0.5327343
[2,] 0.0766722 1.672081 1.224415 -0.6863892 0.8681891 -1.080274 0.5327343
          [,57]     [,58]     [,59]     [,60]     [,61]     [,62]    [,63]
[1,] -0.2091447 0.4687851 -1.604979 0.6222793 -0.339844 -1.746063 -1.05565
[2,] -0.2091447 0.4687851 -1.604979 0.6222793 -0.339844 -1.746063 -1.05565
         [,64]    [,65]      [,66]    [,67]     [,68]      [,69]    [,70]
[1,] 0.1085096 1.738766 -0.3591516 0.444904 -1.003604 -0.5771198 1.031029
[2,] 0.1085096 1.738766 -0.3591516 0.444904 -1.003604 -0.5771198 1.031029
         [,71]      [,72]     [,73]     [,74]     [,75]    [,76]       [,77]
[1,] -0.503756 -0.2955566 -1.335939 0.2099316 0.7015706 1.786024 -0.02615414
[2,] -0.503756 -0.2955566 -1.335939 0.2099316 0.7015706 1.786024 -0.02615414
         [,78]     [,79]      [,80]     [,81]       [,82]     [,83]     [,84]
[1,] 0.3547543 -2.761901 0.03778768 0.5021553 -0.08619014 0.6983146 0.2011116
[2,] 0.3547543 -2.761901 0.03778768 0.5021553 -0.08619014 0.6983146 0.2011116
          [,85]     [,86]    [,87]    [,88]      [,89]     [,90]       [,91]
[1,] -0.4267686 0.2773799 0.918981 1.500355 0.09724073 0.6739798 -0.07217963
[2,] -0.4267686 0.2773799 0.918981 1.500355 0.09724073 0.6739798 -0.07217963
          [,92]     [,93]     [,94]      [,95]     [,96]      [,97]     [,98]
[1,] -0.6193154 0.2114461 -1.074611 -0.0157059 0.8273684 -0.5418155 -1.719635
[2,] -0.6193154 0.2114461 -1.074611 -0.0157059 0.8273684 -0.5418155 -1.719635
          [,99]   [,100]
[1,] -0.6023934 1.422295
[2,] -0.6023934 1.422295
> 
> 
> Max(tmp2)
[1] 2.520331
> Min(tmp2)
[1] -2.230705
> mean(tmp2)
[1] -0.05851101
> Sum(tmp2)
[1] -5.851101
> Var(tmp2)
[1] 0.9004922
> 
> rowMeans(tmp2)
  [1]  0.09339625  0.28401245 -0.90332986  1.09121177 -2.02421763  0.32558882
  [7] -0.90201639 -0.73461592 -1.13898431  1.25704351 -1.48576923  0.93730908
 [13]  0.38407943  1.20229146  0.04869182 -2.23070469 -1.04019998  0.59307968
 [19] -1.17658111  0.10163099 -0.15224948 -0.03701826 -1.29244853 -0.05258691
 [25] -0.41620153 -0.80459229 -1.09613754 -1.40198645 -0.61054296  1.02309334
 [31]  1.02419540  0.47305545 -0.03078181 -0.85982105  0.22012370  0.70398082
 [37] -0.52061240  1.57339705 -1.35482051 -0.89419679 -0.37707181 -0.53533547
 [43] -0.26992426  1.06573772  0.71426325 -1.74057715 -0.55798191  0.83283157
 [49] -1.54036093 -1.27479051 -0.97826879  0.50566292  1.29980780  0.28722990
 [55] -0.29964459 -0.14332847 -0.06777376 -0.02697959  0.96274876  2.52033135
 [61]  0.70319415  0.68297590  0.08960544  1.32835137  0.77824532 -0.65310894
 [67]  1.80685682  0.92869132 -0.94155945 -2.14730053 -0.54874646  0.90859928
 [73]  0.28330663  0.30804615  1.06832648 -1.18093450  0.33706675  0.73866646
 [79] -1.15830315  0.65960628  0.57140159 -0.97061536 -0.56178145  1.00821935
 [85] -0.77743993  0.69803274 -1.01958045  0.62435718  0.59360792  1.16533126
 [91]  0.23760940  0.75948792 -0.10922917 -1.30647908 -0.01480610  0.20694979
 [97] -0.60232088 -0.87277057 -0.66660889  0.64160657
> rowSums(tmp2)
  [1]  0.09339625  0.28401245 -0.90332986  1.09121177 -2.02421763  0.32558882
  [7] -0.90201639 -0.73461592 -1.13898431  1.25704351 -1.48576923  0.93730908
 [13]  0.38407943  1.20229146  0.04869182 -2.23070469 -1.04019998  0.59307968
 [19] -1.17658111  0.10163099 -0.15224948 -0.03701826 -1.29244853 -0.05258691
 [25] -0.41620153 -0.80459229 -1.09613754 -1.40198645 -0.61054296  1.02309334
 [31]  1.02419540  0.47305545 -0.03078181 -0.85982105  0.22012370  0.70398082
 [37] -0.52061240  1.57339705 -1.35482051 -0.89419679 -0.37707181 -0.53533547
 [43] -0.26992426  1.06573772  0.71426325 -1.74057715 -0.55798191  0.83283157
 [49] -1.54036093 -1.27479051 -0.97826879  0.50566292  1.29980780  0.28722990
 [55] -0.29964459 -0.14332847 -0.06777376 -0.02697959  0.96274876  2.52033135
 [61]  0.70319415  0.68297590  0.08960544  1.32835137  0.77824532 -0.65310894
 [67]  1.80685682  0.92869132 -0.94155945 -2.14730053 -0.54874646  0.90859928
 [73]  0.28330663  0.30804615  1.06832648 -1.18093450  0.33706675  0.73866646
 [79] -1.15830315  0.65960628  0.57140159 -0.97061536 -0.56178145  1.00821935
 [85] -0.77743993  0.69803274 -1.01958045  0.62435718  0.59360792  1.16533126
 [91]  0.23760940  0.75948792 -0.10922917 -1.30647908 -0.01480610  0.20694979
 [97] -0.60232088 -0.87277057 -0.66660889  0.64160657
> 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.09339625  0.28401245 -0.90332986  1.09121177 -2.02421763  0.32558882
  [7] -0.90201639 -0.73461592 -1.13898431  1.25704351 -1.48576923  0.93730908
 [13]  0.38407943  1.20229146  0.04869182 -2.23070469 -1.04019998  0.59307968
 [19] -1.17658111  0.10163099 -0.15224948 -0.03701826 -1.29244853 -0.05258691
 [25] -0.41620153 -0.80459229 -1.09613754 -1.40198645 -0.61054296  1.02309334
 [31]  1.02419540  0.47305545 -0.03078181 -0.85982105  0.22012370  0.70398082
 [37] -0.52061240  1.57339705 -1.35482051 -0.89419679 -0.37707181 -0.53533547
 [43] -0.26992426  1.06573772  0.71426325 -1.74057715 -0.55798191  0.83283157
 [49] -1.54036093 -1.27479051 -0.97826879  0.50566292  1.29980780  0.28722990
 [55] -0.29964459 -0.14332847 -0.06777376 -0.02697959  0.96274876  2.52033135
 [61]  0.70319415  0.68297590  0.08960544  1.32835137  0.77824532 -0.65310894
 [67]  1.80685682  0.92869132 -0.94155945 -2.14730053 -0.54874646  0.90859928
 [73]  0.28330663  0.30804615  1.06832648 -1.18093450  0.33706675  0.73866646
 [79] -1.15830315  0.65960628  0.57140159 -0.97061536 -0.56178145  1.00821935
 [85] -0.77743993  0.69803274 -1.01958045  0.62435718  0.59360792  1.16533126
 [91]  0.23760940  0.75948792 -0.10922917 -1.30647908 -0.01480610  0.20694979
 [97] -0.60232088 -0.87277057 -0.66660889  0.64160657
> rowMin(tmp2)
  [1]  0.09339625  0.28401245 -0.90332986  1.09121177 -2.02421763  0.32558882
  [7] -0.90201639 -0.73461592 -1.13898431  1.25704351 -1.48576923  0.93730908
 [13]  0.38407943  1.20229146  0.04869182 -2.23070469 -1.04019998  0.59307968
 [19] -1.17658111  0.10163099 -0.15224948 -0.03701826 -1.29244853 -0.05258691
 [25] -0.41620153 -0.80459229 -1.09613754 -1.40198645 -0.61054296  1.02309334
 [31]  1.02419540  0.47305545 -0.03078181 -0.85982105  0.22012370  0.70398082
 [37] -0.52061240  1.57339705 -1.35482051 -0.89419679 -0.37707181 -0.53533547
 [43] -0.26992426  1.06573772  0.71426325 -1.74057715 -0.55798191  0.83283157
 [49] -1.54036093 -1.27479051 -0.97826879  0.50566292  1.29980780  0.28722990
 [55] -0.29964459 -0.14332847 -0.06777376 -0.02697959  0.96274876  2.52033135
 [61]  0.70319415  0.68297590  0.08960544  1.32835137  0.77824532 -0.65310894
 [67]  1.80685682  0.92869132 -0.94155945 -2.14730053 -0.54874646  0.90859928
 [73]  0.28330663  0.30804615  1.06832648 -1.18093450  0.33706675  0.73866646
 [79] -1.15830315  0.65960628  0.57140159 -0.97061536 -0.56178145  1.00821935
 [85] -0.77743993  0.69803274 -1.01958045  0.62435718  0.59360792  1.16533126
 [91]  0.23760940  0.75948792 -0.10922917 -1.30647908 -0.01480610  0.20694979
 [97] -0.60232088 -0.87277057 -0.66660889  0.64160657
> 
> colMeans(tmp2)
[1] -0.05851101
> colSums(tmp2)
[1] -5.851101
> colVars(tmp2)
[1] 0.9004922
> colSd(tmp2)
[1] 0.9489427
> colMax(tmp2)
[1] 2.520331
> colMin(tmp2)
[1] -2.230705
> colMedians(tmp2)
[1] -0.02089285
> colRanges(tmp2)
          [,1]
[1,] -2.230705
[2,]  2.520331
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.57386600 -2.78857284 -0.05046111  1.36853067  3.18798399  0.90512671
 [7]  4.68943174 -5.27762065 -3.93726052 -4.21843949
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.6474529
[2,] -0.2952567
[3,]  0.1234115
[4,]  0.4724194
[5,]  1.8953911
> 
> rowApply(tmp,sum)
 [1]  1.502056  3.632128 -2.283560 -2.289566  2.077098  1.142226  4.114282
 [8] -6.293839  0.517435 -5.665677
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    7    8   10    4    5    5    6    8     3
 [2,]    8    5    3    8    6    1    3    7    2     7
 [3,]   10    4    2    6    8    8    9    3    1     8
 [4,]    3    8    9    3   10   10    2    1    9     9
 [5,]    5   10    6    2    2    9   10   10   10     2
 [6,]    1    6    5    9    9    4    7    5    3    10
 [7,]    9    9   10    1    7    6    6    9    7     6
 [8,]    2    1    1    5    5    2    8    2    5     4
 [9,]    7    2    4    7    1    7    1    8    4     5
[10,]    6    3    7    4    3    3    4    4    6     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.84197925  0.00783741  0.19496764  0.29335996  2.66708418 -0.17425641
 [7]  0.07223587  1.97947817  1.79400210  4.15575779 -0.36476038 -0.78779178
[13]  3.47133556  0.12379482 -1.91690206  5.03412294 -1.00795143  1.96744742
[19] -4.51861260  0.75026175
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.11806338
[2,] -0.32969053
[3,] -0.26873607
[4,]  0.08478018
[5,]  0.78973055
> 
> rowApply(tmp,sum)
[1] -1.0920483  8.3345731 -1.2628359  0.7544036  6.1653391
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    2    8   11   16    4
[2,]    3   11    7   13   13
[3,]    1    9    6   19   12
[4,]   11    6   15   17    2
[5,]   13   15   18    5   19
> 
> 
> as.matrix(tmp)
            [,1]       [,2]       [,3]        [,4]         [,5]       [,6]
[1,] -1.11806338 -1.1172151 -2.2102251 -0.17215032  0.001272753 -0.8667937
[2,]  0.08478018  0.4401658  0.2434431  0.01366488  0.811631998 -0.2459704
[3,] -0.26873607 -0.6095722 -0.6109428  0.51221753  1.619432266 -0.5279206
[4,]  0.78973055  0.6535620  2.1885346  0.87564594 -1.053353460  0.7552047
[5,] -0.32969053  0.6408970  0.5841578 -0.93601806  1.288100628  0.7112237
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.7858339 -0.4713956 -0.4719794 -1.0164124  1.78641390  0.4010339
[2,] -0.2601756  2.0873562  0.8216987  0.6380212  0.08395761 -0.2373661
[3,] -1.8756777  0.3604177  0.5966284  1.9933156 -0.32880292 -1.0337592
[4,]  0.7737130 -1.1630413  0.1554924  0.1680193 -1.21160334  0.3811632
[5,]  0.6485423  1.1661411  0.6921621  2.3728141 -0.69472563 -0.2988636
           [,13]        [,14]       [,15]      [,16]      [,17]      [,18]
[1,] -0.11727274  3.310533120 -0.24852397 -1.0550005  1.3016208  1.0710056
[2,]  0.41336468 -2.340623411  0.70483496  1.7681435 -0.6662174  1.6012640
[3,]  2.25730902  0.006664272 -1.31155876  1.5660172 -0.5805195 -0.7870558
[4,]  0.93535582 -0.963949785 -0.99783601  2.6466905 -1.8834002 -0.3871414
[5,] -0.01742123  0.111170627 -0.06381828  0.1082722  0.8205649  0.4693750
          [,19]       [,20]
[1,] -0.9712130  0.08648286
[2,]  0.5142695  1.85832971
[3,] -2.5926661  0.35237389
[4,] -1.7746898 -0.13369296
[5,]  0.3056868 -1.41323175
> 
> 
> 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.13-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.13-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.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  591  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.13-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.219455 -1.699551 0.8115596 2.522122 2.158123 0.2537905 0.1260021
            col8      col9       col10    col11     col12      col13     col14
row1 -0.03272168 -2.028571 -0.03722561 1.884112 0.2976319 -0.8645679 -1.886554
         col15     col16      col17    col18   col19    col20
row1 0.8706965 0.9295181 -0.6269355 1.693972 -1.1185 1.941626
> tmp[,"col10"]
           col10
row1 -0.03722561
row2  2.21944201
row3  1.44339461
row4 -0.07621294
row5  0.27111523
> tmp[c("row1","row5"),]
          col1      col2      col3       col4      col5       col6       col7
row1  1.219455 -1.699551 0.8115596  2.5221224  2.158123  0.2537905  0.1260021
row5 -1.381746 -1.257792 2.4088728 -0.3811673 -1.673583 -0.6900219 -1.4236768
            col8      col9       col10     col11     col12      col13
row1 -0.03272168 -2.028571 -0.03722561 1.8841122 0.2976319 -0.8645679
row5 -0.88546223  0.388285  0.27111523 0.9717742 1.6184777 -0.2575651
          col14      col15      col16      col17     col18      col19
row1 -1.8865540  0.8706965  0.9295181 -0.6269355 1.6939722 -1.1184998
row5  0.4055304 -1.6939956 -1.1452020 -0.9718392 0.4940527  0.3809668
          col20
row1 1.94162602
row5 0.05840571
> tmp[,c("col6","col20")]
           col6       col20
row1  0.2537905  1.94162602
row2 -1.1691951 -1.02739785
row3  0.2490669  0.23712395
row4  1.5975734  0.01397553
row5 -0.6900219  0.05840571
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.2537905 1.94162602
row5 -0.6900219 0.05840571
> 
> 
> 
> 
> 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.1547 51.14957 52.37495 48.62488 50.60148 104.6578 48.19236 50.35973
         col9    col10    col11    col12    col13    col14    col15    col16
row1 47.98821 48.47707 49.51774 49.94565 49.47144 50.53862 49.57455 51.05475
        col17    col18    col19    col20
row1 49.13332 50.32038 52.17425 102.9641
> tmp[,"col10"]
        col10
row1 48.47707
row2 31.62305
row3 27.93122
row4 29.35670
row5 50.66880
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.15470 51.14957 52.37495 48.62488 50.60148 104.6578 48.19236 50.35973
row5 50.26165 51.04387 51.71254 51.91788 51.33966 104.2456 48.66357 50.60696
         col9    col10    col11    col12    col13    col14    col15    col16
row1 47.98821 48.47707 49.51774 49.94565 49.47144 50.53862 49.57455 51.05475
row5 51.76556 50.66880 50.69194 50.61556 48.84813 50.03624 48.38273 50.61621
        col17    col18    col19    col20
row1 49.13332 50.32038 52.17425 102.9641
row5 49.19351 48.72150 48.63081 104.9494
> tmp[,c("col6","col20")]
          col6     col20
row1 104.65783 102.96409
row2  73.04280  76.56993
row3  75.11258  73.75526
row4  74.06008  74.20788
row5 104.24561 104.94943
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.6578 102.9641
row5 104.2456 104.9494
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.6578 102.9641
row5 104.2456 104.9494
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.3805378
[2,] -0.2409139
[3,] -1.3326672
[4,] -0.2602142
[5,] -1.2710049
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.1124810  0.1895087
[2,]  0.8478620 -0.2703570
[3,]  1.2189454 -0.5894409
[4,] -0.2673245 -1.3170636
[5,]  0.4938136 -1.0003124
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.6431239  0.2802621
[2,]  1.0253028  0.2857162
[3,] -1.1546607  0.5378846
[4,]  0.5492393 -0.9242754
[5,]  0.2224960 -0.6191770
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.6431239
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.6431239
[2,] 1.0253028
> 
> 
> 
> 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.612654 0.8498280 -0.6472232 -0.4654773 -2.844473  0.06912742 1.0093722
row1 -1.304102 0.4087952 -1.3211966  1.3906285 -0.257615 -0.81852088 0.4031956
         [,8]     [,9]      [,10]       [,11]     [,12]      [,13]     [,14]
row3 1.959277 2.632377 -0.7466098  1.41950781 0.3572662  0.9391746 0.9169250
row1 2.199745 1.251372  1.2402437 -0.07116192 0.9776682 -0.5984622 0.8989347
         [,15]      [,16]      [,17]      [,18]     [,19]      [,20]
row3 0.8425545  0.1897725 -1.2802621  0.3807423 1.4085932 -0.2043043
row1 1.0894719 -1.2909831  0.2976932 -0.4696575 0.4343414 -1.4969689
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]     [,3]     [,4]       [,5]       [,6]       [,7]
row2 0.5432444 -0.2427843 2.913471 1.535998 -0.5143765 0.02843307 -0.7402486
           [,8]      [,9]      [,10]
row2 -0.8533027 0.6607227 -0.3415851
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]       [,3]       [,4]       [,5]       [,6]      [,7]
row5 0.1287483 1.049695 -0.5751243 -0.6905166 -0.6415959 -0.4797008 -2.078052
          [,8]     [,9]    [,10]    [,11]     [,12]    [,13]    [,14]
row5 0.9412111 1.288326 1.628679 1.024299 0.4021431 1.188873 1.273444
          [,15]    [,16]    [,17]     [,18]    [,19]     [,20]
row5 -0.9119359 1.667223 0.761628 -1.881672 1.297499 0.7857588
> 
> 
> 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: 0x00000000071af230>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c6b54e16" 
 [2] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c69b7619a"
 [3] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c14dd11c5"
 [4] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c4ada247c"
 [5] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c6dfc3840"
 [6] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c43c634b0"
 [7] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c34b65c1f"
 [8] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c3b412ebb"
 [9] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c3ad541d" 
[10] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145cbad2640" 
[11] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c47ea1127"
[12] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c46e754bc"
[13] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c43d962b3"
[14] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c716e2074"
[15] "C:/Users/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM145c43955553"
> 
> 
> ### 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: 0x000000000c889670>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x000000000c889670>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.13-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x000000000c889670>
> rowMedians(tmp)
  [1]  0.107284989 -0.079893188 -0.227818493  0.146550198 -0.078862751
  [6] -0.098195458  0.207716164  0.516085869 -0.717504938  0.067895979
 [11]  0.003381237 -0.424279738  0.294066203  0.567385848 -0.394028850
 [16]  0.189740353 -0.217434954  0.141411562  0.135766237  0.139675090
 [21] -0.404903899 -0.390192082 -0.000630674 -0.253543837  0.359872544
 [26] -0.273408696  0.053013390  0.382052108 -0.252940740  0.034154760
 [31]  0.618702511  0.337549301 -0.298024144 -0.063302005 -0.507636054
 [36] -0.206389499  0.288301063  0.055797719  0.536427524 -0.251957202
 [41] -0.344957517  0.303457379  0.018838547 -0.138579005  0.325532260
 [46]  0.221883359  0.334191887 -0.246739755 -0.249794335 -0.105022977
 [51]  0.501936676  0.659517726  0.538686020  0.258772366  0.499373024
 [56] -0.147731100  0.864567813  0.021302000  0.096012775 -0.163860351
 [61] -0.183877674  0.086113544  0.444078894 -0.016355117 -0.271287764
 [66] -0.331997797 -0.182096507 -0.033133156 -0.410945749 -0.107117063
 [71]  0.105225671  0.712325117 -0.602873188  0.279836710 -0.134098740
 [76] -0.016787943  0.718810423  0.230851841 -0.224752265  0.065610551
 [81] -0.507356084  0.125720680  0.232947017  0.448388504  0.092243663
 [86]  0.302992761 -0.303681470 -0.069006614 -0.202799496  0.020013558
 [91] -0.042189516  0.425509990  0.343235180  0.388609566 -0.115678015
 [96]  0.098377093 -0.305884644  0.069202043 -0.389351471  0.080057050
[101] -0.099733465  0.401529274  0.344805154  0.219561963  0.048848914
[106]  0.465905702 -0.424103404  0.131460902 -0.127286967 -0.062501769
[111]  0.205012855 -0.365135309 -0.093791526  0.510634615  0.520116143
[116] -0.071962372  0.029131061 -0.361393282  0.456265437  0.062217220
[121] -0.678886488 -0.363425058 -0.986412080  0.022243923  0.581581880
[126]  0.104343636  0.073801999  0.285063005 -0.405060798  0.314616330
[131] -0.104727957 -0.034741701  0.164096237  0.166251916  0.230197761
[136] -0.479399495 -0.008142733  0.124386091 -0.158074193 -0.017451768
[141]  0.130487069 -0.040572099  0.258383566  0.052063340 -0.015450822
[146]  0.384291820  0.342371921 -0.099749470 -0.134908518  0.058995009
[151]  0.253335180 -0.209771318 -0.199200079 -0.333048860 -0.699093364
[156]  0.245591485  0.534010678 -0.032830239  0.094138301 -0.404630622
[161]  0.426356099  0.458291052 -0.166690176 -0.157992890 -0.083387035
[166]  0.038280374 -0.140648526 -0.408741052 -0.125934241  0.080120906
[171]  0.291013306  0.111167438  0.157878207 -0.175194676 -0.474136651
[176]  0.064035268  0.249505692  0.195700093 -0.364964868 -0.175344842
[181]  0.163600422 -0.071043055 -0.711548669  0.178688187 -0.298129269
[186] -0.028318394  0.349548417  0.221771718  0.441407067  0.020702203
[191] -0.390404134 -0.019803847 -0.070700025 -0.104878244  0.124634528
[196]  0.267766256 -0.234457362 -0.150925269 -0.015500507 -0.576972933
[201] -0.072229675  0.160792105  0.384147961  0.287374666 -0.061056148
[206] -0.045895937  0.266863441 -0.632919031  0.100231791  0.064252946
[211]  0.609480740 -0.006375427  0.155587913  0.049323657  0.230760688
[216] -0.304749180 -0.021351742  0.092621643  0.153097170  0.102269196
[221]  0.018359615  0.091233349 -0.341446314  0.604283248  0.069018085
[226]  0.197310797  0.418441746 -0.552627589 -0.173253631  0.302046885
> 
> proc.time()
   user  system elapsed 
   2.59    7.59   10.32 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x02169df8>
> .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: 0x02169df8>
> .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: 0x02169df8>
> .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: 0x02169df8>
> 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: 0x03f0e648>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03f0e648>
> .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: 0x03f0e648>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03f0e648>
> .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: 0x03f0e648>
> 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: 0x03eff940>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03eff940>
> .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: 0x03eff940>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x03eff940>
> .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: 0x03eff940>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x03eff940>
> .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: 0x03eff940>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x03eff940>
> .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: 0x03eff940>
> 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: 0x024ba568>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x024ba568>
> .Call("R_bm_AddColumn",P)
<pointer: 0x024ba568>
> .Call("R_bm_AddColumn",P)
<pointer: 0x024ba568>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile538573274a1" "BufferedMatrixFile53858b766e5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile538573274a1" "BufferedMatrixFile53858b766e5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0292ae70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0292ae70>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0292ae70>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0292ae70>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0292ae70>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0292ae70>
> .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: 0x024f64f0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x024f64f0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x024f64f0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x024f64f0>
> 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: 0x01e72b48>
> .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: 0x01e72b48>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.59    0.07    0.65 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x0000000006f67940>
> .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: 0x0000000006f67940>
> .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: 0x0000000006f67940>
> .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: 0x0000000006f67940>
> 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: 0x0000000007726ad0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007726ad0>
> .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: 0x0000000007726ad0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007726ad0>
> .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: 0x0000000007726ad0>
> 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: 0x0000000006279150>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000006279150>
> .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: 0x0000000006279150>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000006279150>
> .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: 0x0000000006279150>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000006279150>
> .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: 0x0000000006279150>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000006279150>
> .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: 0x0000000006279150>
> 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: 0x0000000004d5f888>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000004d5f888>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000004d5f888>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000004d5f888>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile15542dc523fe" "BufferedMatrixFile155477034ff6"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile15542dc523fe" "BufferedMatrixFile155477034ff6"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005dfe4f8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005dfe4f8>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005dfe4f8>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005dfe4f8>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005dfe4f8>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005dfe4f8>
> .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: 0x00000000058eecd0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000058eecd0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000058eecd0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x00000000058eecd0>
> 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: 0x00000000063d69e0>
> .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: 0x00000000063d69e0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.57    0.07    0.64 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

Example timings