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

This page was generated on 2022-04-13 12:06:16 -0400 (Wed, 13 Apr 2022).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 20.04.4 LTS)x86_644.1.3 (2022-03-10) -- "One Push-Up" 4324
tokay2Windows Server 2012 R2 Standardx644.1.3 (2022-03-10) -- "One Push-Up" 4077
machv2macOS 10.14.6 Mojavex86_644.1.3 (2022-03-10) -- "One Push-Up" 4137
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

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? 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 223/2083HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.58.0  (landing page)
Ben Bolstad
Snapshot Date: 2022-04-12 01:55:07 -0400 (Tue, 12 Apr 2022)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_14
git_last_commit: 2d3839c
git_last_commit_date: 2021-10-26 11:50:47 -0400 (Tue, 26 Oct 2021)
nebbiolo2Linux (Ubuntu 20.04.4 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.58.0
Command: C:\Users\biocbuild\bbs-3.14-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.14-bioc\R\library --no-vignettes --timings BufferedMatrix_1.58.0.tar.gz
StartedAt: 2022-04-12 16:40:35 -0400 (Tue, 12 Apr 2022)
EndedAt: 2022-04-12 16:41:52 -0400 (Tue, 12 Apr 2022)
EllapsedTime: 77.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory 'C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.1.3 (2022-03-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.58.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.14-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.14-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.14-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.166/BBS/3.14/bioc/src/contrib/BufferedMatrix_1.58.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.14-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.58.0.tar.gz && C:\Users\biocbuild\bbs-3.14-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.58.0.zip && rm BufferedMatrix_1.58.0.tar.gz BufferedMatrix_1.58.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
  6  202k    6 13311    0     0   111k      0  0:00:01 --:--:--  0:00:01  112k
100  202k  100  202k    0     0   348k      0 --:--:-- --:--:-- --:--:--  348k

install for i386

* installing *source* package 'BufferedMatrix' ...
** using staged installation
** libs
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.14-/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.14-/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.14-/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.14-/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.14-/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.14-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.14-/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.14-/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.14-/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.14-/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.14-/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.58.0.zip
* DONE (BufferedMatrix)
* installing to library 'C:/Users/biocbuild/bbs-3.14-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.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.56    0.07    0.62 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.59    0.10    0.68 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.14-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 436754 13.4     924427 28.3   646882 19.8
Vcells 499421  3.9    8388608 64.0  1648009 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] "Tue Apr 12 16:41:18 2022"
> 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] "Tue Apr 12 16:41:18 2022"
> 
> 
> 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: 0x036746a8>
> 
> 
> 
> 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] "Tue Apr 12 16:41:20 2022"
> 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] "Tue Apr 12 16:41:21 2022"
> 
> ColMode(tmp2)
<pointer: 0x036746a8>
> 
> 
> 
> ### 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.6235117 -1.7734127  0.8561771 -2.18467166
[2,]  0.8316364 -0.2270611 -1.1410895 -0.05878097
[3,] -0.2756779  0.2978849  0.8821490  0.24691828
[4,]  1.0205611  0.8957574  0.1233232 -0.88032878
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-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.6235117 1.7734127 0.8561771 2.18467166
[2,]  0.8316364 0.2270611 1.1410895 0.05878097
[3,]  0.2756779 0.2978849 0.8821490 0.24691828
[4,]  1.0205611 0.8957574 0.1233232 0.88032878
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-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.9811578 1.3316954 0.9252984 1.4780635
[2,] 0.9119410 0.4765092 1.0682179 0.2424479
[3,] 0.5250503 0.5457883 0.9392279 0.4969087
[4,] 1.0102282 0.9464446 0.3511741 0.9382584
> 
> 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.14-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,] 224.43509 40.09037 35.10916 41.96531
[2,]  34.95105 29.99215 36.82327 27.48326
[3,]  30.52618 30.75577 35.27443 30.21601
[4,]  36.12284 35.36020 28.63506 35.26291
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x030e0738>
> exp(tmp5)
<pointer: 0x030e0738>
> log(tmp5,2)
<pointer: 0x030e0738>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.1322
> Min(tmp5)
[1] 52.31468
> mean(tmp5)
[1] 72.85872
> Sum(tmp5)
[1] 14571.74
> Var(tmp5)
[1] 852.5929
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.35129 70.15346 70.40037 70.67958 72.48387 71.86857 70.35402 73.53351
 [9] 69.16953 70.59304
> rowSums(tmp5)
 [1] 1787.026 1403.069 1408.007 1413.592 1449.677 1437.371 1407.080 1470.670
 [9] 1383.391 1411.861
> rowVars(tmp5)
 [1] 7974.39707   74.61185   84.89680   46.06734   71.71644   65.00570
 [7]   78.72879   82.89402   78.24630   39.84698
> rowSd(tmp5)
 [1] 89.299480  8.637815  9.213946  6.787292  8.468556  8.062611  8.872925
 [8]  9.104616  8.845694  6.312447
> rowMax(tmp5)
 [1] 467.13223  86.14123  89.54421  82.03922  89.22222  84.36933  94.97404
 [8]  87.88716  83.23082  85.69658
> rowMin(tmp5)
 [1] 53.86372 55.27357 52.31468 59.03987 55.29435 57.64845 59.07106 57.80875
 [9] 53.05612 59.79683
> 
> colMeans(tmp5)
 [1] 107.27741  69.51389  71.67480  68.70574  74.22314  69.58159  76.60678
 [8]  68.73097  67.65901  70.27320  70.79721  72.66246  68.84766  66.85970
[15]  76.42492  72.69571  67.82584  71.53837  71.19540  74.08065
> colSums(tmp5)
 [1] 1072.7741  695.1389  716.7480  687.0574  742.2314  695.8159  766.0678
 [8]  687.3097  676.5901  702.7320  707.9721  726.6246  688.4766  668.5970
[15]  764.2492  726.9571  678.2584  715.3837  711.9540  740.8065
> colVars(tmp5)
 [1] 16029.20714    66.70826    55.44576   125.72749    79.92515   110.87380
 [7]    63.81051    14.11865    60.06617    36.52673    67.71418    68.91093
[13]    93.07388    79.03410    76.75128    89.84693    29.12163    28.06007
[19]    45.09256    84.72224
> colSd(tmp5)
 [1] 126.606505   8.167512   7.446191  11.212827   8.940087  10.529663
 [7]   7.988148   3.757479   7.750237   6.043735   8.228862   8.301261
[13]   9.647480   8.890112   8.760781   9.478762   5.396446   5.297175
[19]   6.715099   9.204468
> colMax(tmp5)
 [1] 467.13223  83.44285  81.38929  87.34529  85.92632  87.88716  89.54421
 [8]  77.04336  86.14123  79.48048  83.42476  87.33384  80.77594  83.27520
[15]  94.97404  84.36933  78.92233  78.04319  80.89840  89.22222
> colMin(tmp5)
 [1] 53.05612 60.36897 59.60013 56.50402 57.07493 52.31468 63.87384 63.80197
 [9] 57.64845 60.52338 60.29403 63.43830 55.27357 53.86372 65.94768 55.29435
[17] 59.38892 62.72993 60.34731 61.38873
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1]       NA 70.15346 70.40037 70.67958 72.48387 71.86857 70.35402 73.53351
 [9] 69.16953 70.59304
> rowSums(tmp5)
 [1]       NA 1403.069 1408.007 1413.592 1449.677 1437.371 1407.080 1470.670
 [9] 1383.391 1411.861
> rowVars(tmp5)
 [1] 8401.92710   74.61185   84.89680   46.06734   71.71644   65.00570
 [7]   78.72879   82.89402   78.24630   39.84698
> rowSd(tmp5)
 [1] 91.662026  8.637815  9.213946  6.787292  8.468556  8.062611  8.872925
 [8]  9.104616  8.845694  6.312447
> rowMax(tmp5)
 [1]       NA 86.14123 89.54421 82.03922 89.22222 84.36933 94.97404 87.88716
 [9] 83.23082 85.69658
> rowMin(tmp5)
 [1]       NA 55.27357 52.31468 59.03987 55.29435 57.64845 59.07106 57.80875
 [9] 53.05612 59.79683
> 
> colMeans(tmp5)
 [1] 107.27741  69.51389        NA  68.70574  74.22314  69.58159  76.60678
 [8]  68.73097  67.65901  70.27320  70.79721  72.66246  68.84766  66.85970
[15]  76.42492  72.69571  67.82584  71.53837  71.19540  74.08065
> colSums(tmp5)
 [1] 1072.7741  695.1389        NA  687.0574  742.2314  695.8159  766.0678
 [8]  687.3097  676.5901  702.7320  707.9721  726.6246  688.4766  668.5970
[15]  764.2492  726.9571  678.2584  715.3837  711.9540  740.8065
> colVars(tmp5)
 [1] 16029.20714    66.70826          NA   125.72749    79.92515   110.87380
 [7]    63.81051    14.11865    60.06617    36.52673    67.71418    68.91093
[13]    93.07388    79.03410    76.75128    89.84693    29.12163    28.06007
[19]    45.09256    84.72224
> colSd(tmp5)
 [1] 126.606505   8.167512         NA  11.212827   8.940087  10.529663
 [7]   7.988148   3.757479   7.750237   6.043735   8.228862   8.301261
[13]   9.647480   8.890112   8.760781   9.478762   5.396446   5.297175
[19]   6.715099   9.204468
> colMax(tmp5)
 [1] 467.13223  83.44285        NA  87.34529  85.92632  87.88716  89.54421
 [8]  77.04336  86.14123  79.48048  83.42476  87.33384  80.77594  83.27520
[15]  94.97404  84.36933  78.92233  78.04319  80.89840  89.22222
> colMin(tmp5)
 [1] 53.05612 60.36897       NA 56.50402 57.07493 52.31468 63.87384 63.80197
 [9] 57.64845 60.52338 60.29403 63.43830 55.27357 53.86372 65.94768 55.29435
[17] 59.38892 62.72993 60.34731 61.38873
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.1322
> Min(tmp5,na.rm=TRUE)
[1] 52.31468
> mean(tmp5,na.rm=TRUE)
[1] 72.85764
> Sum(tmp5,na.rm=TRUE)
[1] 14498.67
> Var(tmp5,na.rm=TRUE)
[1] 856.8987
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.20793 70.15346 70.40037 70.67958 72.48387 71.86857 70.35402 73.53351
 [9] 69.16953 70.59304
> rowSums(tmp5,na.rm=TRUE)
 [1] 1713.951 1403.069 1408.007 1413.592 1449.677 1437.371 1407.080 1470.670
 [9] 1383.391 1411.861
> rowVars(tmp5,na.rm=TRUE)
 [1] 8401.92710   74.61185   84.89680   46.06734   71.71644   65.00570
 [7]   78.72879   82.89402   78.24630   39.84698
> rowSd(tmp5,na.rm=TRUE)
 [1] 91.662026  8.637815  9.213946  6.787292  8.468556  8.062611  8.872925
 [8]  9.104616  8.845694  6.312447
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.13223  86.14123  89.54421  82.03922  89.22222  84.36933  94.97404
 [8]  87.88716  83.23082  85.69658
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.86372 55.27357 52.31468 59.03987 55.29435 57.64845 59.07106 57.80875
 [9] 53.05612 59.79683
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.27741  69.51389  71.51920  68.70574  74.22314  69.58159  76.60678
 [8]  68.73097  67.65901  70.27320  70.79721  72.66246  68.84766  66.85970
[15]  76.42492  72.69571  67.82584  71.53837  71.19540  74.08065
> colSums(tmp5,na.rm=TRUE)
 [1] 1072.7741  695.1389  643.6728  687.0574  742.2314  695.8159  766.0678
 [8]  687.3097  676.5901  702.7320  707.9721  726.6246  688.4766  668.5970
[15]  764.2492  726.9571  678.2584  715.3837  711.9540  740.8065
> colVars(tmp5,na.rm=TRUE)
 [1] 16029.20714    66.70826    62.10413   125.72749    79.92515   110.87380
 [7]    63.81051    14.11865    60.06617    36.52673    67.71418    68.91093
[13]    93.07388    79.03410    76.75128    89.84693    29.12163    28.06007
[19]    45.09256    84.72224
> colSd(tmp5,na.rm=TRUE)
 [1] 126.606505   8.167512   7.880617  11.212827   8.940087  10.529663
 [7]   7.988148   3.757479   7.750237   6.043735   8.228862   8.301261
[13]   9.647480   8.890112   8.760781   9.478762   5.396446   5.297175
[19]   6.715099   9.204468
> colMax(tmp5,na.rm=TRUE)
 [1] 467.13223  83.44285  81.38929  87.34529  85.92632  87.88716  89.54421
 [8]  77.04336  86.14123  79.48048  83.42476  87.33384  80.77594  83.27520
[15]  94.97404  84.36933  78.92233  78.04319  80.89840  89.22222
> colMin(tmp5,na.rm=TRUE)
 [1] 53.05612 60.36897 59.60013 56.50402 57.07493 52.31468 63.87384 63.80197
 [9] 57.64845 60.52338 60.29403 63.43830 55.27357 53.86372 65.94768 55.29435
[17] 59.38892 62.72993 60.34731 61.38873
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 70.15346 70.40037 70.67958 72.48387 71.86857 70.35402 73.53351
 [9] 69.16953 70.59304
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1403.069 1408.007 1413.592 1449.677 1437.371 1407.080 1470.670
 [9] 1383.391 1411.861
> rowVars(tmp5,na.rm=TRUE)
 [1]       NA 74.61185 84.89680 46.06734 71.71644 65.00570 78.72879 82.89402
 [9] 78.24630 39.84698
> rowSd(tmp5,na.rm=TRUE)
 [1]       NA 8.637815 9.213946 6.787292 8.468556 8.062611 8.872925 9.104616
 [9] 8.845694 6.312447
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 86.14123 89.54421 82.03922 89.22222 84.36933 94.97404 87.88716
 [9] 83.23082 85.69658
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 55.27357 52.31468 59.03987 55.29435 57.64845 59.07106 57.80875
 [9] 53.05612 59.79683
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 67.29355 67.96622      NaN 66.63468 73.46172 70.22841 77.63487 69.03962
 [9] 68.34542 71.35651 71.35966 73.44578 68.30633 68.30369 76.63737 73.18288
[17] 67.79045 72.38278 71.88799 73.74715
> colSums(tmp5,na.rm=TRUE)
 [1] 605.6419 611.6960   0.0000 599.7121 661.1555 632.0557 698.7139 621.3566
 [9] 615.1088 642.2086 642.2369 661.0120 614.7570 614.7332 689.7363 658.6460
[17] 610.1140 651.4450 646.9919 663.7243
> colVars(tmp5,na.rm=TRUE)
 [1]  47.37307  48.10014        NA  93.18889  83.39347 120.02627  59.89589
 [8]  14.81174  62.27386  27.88995  72.61953  70.62180 101.41146  65.45565
[15]  85.83743  98.40779  32.74774  23.54600  45.33280  94.06126
> colSd(tmp5,na.rm=TRUE)
 [1]  6.882810  6.935426        NA  9.653439  9.132002 10.955650  7.739243
 [8]  3.848602  7.891379  5.281093  8.521709  8.403678 10.070326  8.090467
[15]  9.264849  9.920070  5.722564  4.852422  6.732964  9.698518
> colMax(tmp5,na.rm=TRUE)
 [1] 75.18497 81.35584     -Inf 79.64973 85.92632 87.88716 89.54421 77.04336
 [9] 86.14123 79.48048 83.42476 87.33384 80.77594 83.27520 94.97404 84.36933
[17] 78.92233 78.04319 80.89840 89.22222
> colMin(tmp5,na.rm=TRUE)
 [1] 53.05612 60.36897      Inf 56.50402 57.07493 52.31468 63.87384 63.80197
 [9] 57.64845 62.46630 60.29403 63.43830 55.27357 59.03987 65.94768 55.29435
[17] 59.38892 62.72993 60.34731 61.38873
> 
> 
> 
> 
> 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] 329.1829 209.4597 224.5264 352.8215 264.3569 294.2205 202.8104 178.2544
 [9] 185.5814 122.8890
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 329.1829 209.4597 224.5264 352.8215 264.3569 294.2205 202.8104 178.2544
 [9] 185.5814 122.8890
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.136868e-13  0.000000e+00 -2.842171e-13 -2.842171e-14  5.684342e-14
 [6]  1.421085e-14 -5.684342e-14 -1.421085e-13 -1.136868e-13 -1.136868e-13
[11]  5.684342e-14  0.000000e+00  2.842171e-14 -5.684342e-14  1.421085e-14
[16]  5.684342e-14  5.684342e-14 -2.842171e-14 -2.842171e-13 -2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
5   4 
9   19 
1   7 
7   1 
4   2 
3   9 
2   19 
7   1 
4   10 
6   10 
3   17 
9   16 
5   18 
4   7 
2   14 
5   2 
6   12 
8   14 
4   9 
3   13 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.186224
> Min(tmp)
[1] -2.343475
> mean(tmp)
[1] 0.03798216
> Sum(tmp)
[1] 3.798216
> Var(tmp)
[1] 1.097505
> 
> rowMeans(tmp)
[1] 0.03798216
> rowSums(tmp)
[1] 3.798216
> rowVars(tmp)
[1] 1.097505
> rowSd(tmp)
[1] 1.047619
> rowMax(tmp)
[1] 2.186224
> rowMin(tmp)
[1] -2.343475
> 
> colMeans(tmp)
  [1]  1.47645820  0.34141214 -1.26808763  1.39681680  1.12744502 -0.70360037
  [7]  1.58970918  2.14547151 -0.50102482 -1.50162338  1.96141232  0.54844315
 [13] -0.55995115 -0.22262678  1.89340374  0.83294616 -1.47626642 -0.19525457
 [19] -0.78473676  0.32453177 -0.05764606 -0.82365547  0.24499220 -1.22627213
 [25] -0.23638302 -0.71369009  0.09441837 -0.89358299  0.08707250 -1.67731141
 [31] -1.09910346  2.18622433  0.22140355 -0.99312465  0.17543793  0.51338926
 [37]  0.81807283  0.85751307 -0.55357280  0.31230794  1.35859910  1.69331699
 [43] -1.20230948 -0.62354545 -1.00347113 -1.09292524  0.80475150 -0.46690058
 [49] -1.01343999  0.31401589 -0.03425370 -0.88873367  1.46385337 -1.02127528
 [55]  1.62684694 -0.05660135  1.24211407 -0.14683739  0.89435053  0.55673753
 [61] -1.67507274 -1.21139490  0.79079616 -0.75328509 -2.34347491  0.44433303
 [67]  1.93057115 -0.40692137 -0.23475039 -1.98718846 -0.36136304  1.67808923
 [73] -0.49473446 -0.03916104  0.82341573  0.63591172 -0.75109216  1.45998854
 [79]  0.68874003 -0.13163983  1.39168846 -0.16028740  0.26131037  0.11535128
 [85]  1.25212528  1.01961378 -2.09834821  0.22656130  0.76002687  0.45048337
 [91] -1.22760458 -1.02221929  0.22724828 -0.90459847 -0.79184355 -0.06150404
 [97] -1.15966218 -0.50910821  0.53916986  1.36238537
> colSums(tmp)
  [1]  1.47645820  0.34141214 -1.26808763  1.39681680  1.12744502 -0.70360037
  [7]  1.58970918  2.14547151 -0.50102482 -1.50162338  1.96141232  0.54844315
 [13] -0.55995115 -0.22262678  1.89340374  0.83294616 -1.47626642 -0.19525457
 [19] -0.78473676  0.32453177 -0.05764606 -0.82365547  0.24499220 -1.22627213
 [25] -0.23638302 -0.71369009  0.09441837 -0.89358299  0.08707250 -1.67731141
 [31] -1.09910346  2.18622433  0.22140355 -0.99312465  0.17543793  0.51338926
 [37]  0.81807283  0.85751307 -0.55357280  0.31230794  1.35859910  1.69331699
 [43] -1.20230948 -0.62354545 -1.00347113 -1.09292524  0.80475150 -0.46690058
 [49] -1.01343999  0.31401589 -0.03425370 -0.88873367  1.46385337 -1.02127528
 [55]  1.62684694 -0.05660135  1.24211407 -0.14683739  0.89435053  0.55673753
 [61] -1.67507274 -1.21139490  0.79079616 -0.75328509 -2.34347491  0.44433303
 [67]  1.93057115 -0.40692137 -0.23475039 -1.98718846 -0.36136304  1.67808923
 [73] -0.49473446 -0.03916104  0.82341573  0.63591172 -0.75109216  1.45998854
 [79]  0.68874003 -0.13163983  1.39168846 -0.16028740  0.26131037  0.11535128
 [85]  1.25212528  1.01961378 -2.09834821  0.22656130  0.76002687  0.45048337
 [91] -1.22760458 -1.02221929  0.22724828 -0.90459847 -0.79184355 -0.06150404
 [97] -1.15966218 -0.50910821  0.53916986  1.36238537
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.47645820  0.34141214 -1.26808763  1.39681680  1.12744502 -0.70360037
  [7]  1.58970918  2.14547151 -0.50102482 -1.50162338  1.96141232  0.54844315
 [13] -0.55995115 -0.22262678  1.89340374  0.83294616 -1.47626642 -0.19525457
 [19] -0.78473676  0.32453177 -0.05764606 -0.82365547  0.24499220 -1.22627213
 [25] -0.23638302 -0.71369009  0.09441837 -0.89358299  0.08707250 -1.67731141
 [31] -1.09910346  2.18622433  0.22140355 -0.99312465  0.17543793  0.51338926
 [37]  0.81807283  0.85751307 -0.55357280  0.31230794  1.35859910  1.69331699
 [43] -1.20230948 -0.62354545 -1.00347113 -1.09292524  0.80475150 -0.46690058
 [49] -1.01343999  0.31401589 -0.03425370 -0.88873367  1.46385337 -1.02127528
 [55]  1.62684694 -0.05660135  1.24211407 -0.14683739  0.89435053  0.55673753
 [61] -1.67507274 -1.21139490  0.79079616 -0.75328509 -2.34347491  0.44433303
 [67]  1.93057115 -0.40692137 -0.23475039 -1.98718846 -0.36136304  1.67808923
 [73] -0.49473446 -0.03916104  0.82341573  0.63591172 -0.75109216  1.45998854
 [79]  0.68874003 -0.13163983  1.39168846 -0.16028740  0.26131037  0.11535128
 [85]  1.25212528  1.01961378 -2.09834821  0.22656130  0.76002687  0.45048337
 [91] -1.22760458 -1.02221929  0.22724828 -0.90459847 -0.79184355 -0.06150404
 [97] -1.15966218 -0.50910821  0.53916986  1.36238537
> colMin(tmp)
  [1]  1.47645820  0.34141214 -1.26808763  1.39681680  1.12744502 -0.70360037
  [7]  1.58970918  2.14547151 -0.50102482 -1.50162338  1.96141232  0.54844315
 [13] -0.55995115 -0.22262678  1.89340374  0.83294616 -1.47626642 -0.19525457
 [19] -0.78473676  0.32453177 -0.05764606 -0.82365547  0.24499220 -1.22627213
 [25] -0.23638302 -0.71369009  0.09441837 -0.89358299  0.08707250 -1.67731141
 [31] -1.09910346  2.18622433  0.22140355 -0.99312465  0.17543793  0.51338926
 [37]  0.81807283  0.85751307 -0.55357280  0.31230794  1.35859910  1.69331699
 [43] -1.20230948 -0.62354545 -1.00347113 -1.09292524  0.80475150 -0.46690058
 [49] -1.01343999  0.31401589 -0.03425370 -0.88873367  1.46385337 -1.02127528
 [55]  1.62684694 -0.05660135  1.24211407 -0.14683739  0.89435053  0.55673753
 [61] -1.67507274 -1.21139490  0.79079616 -0.75328509 -2.34347491  0.44433303
 [67]  1.93057115 -0.40692137 -0.23475039 -1.98718846 -0.36136304  1.67808923
 [73] -0.49473446 -0.03916104  0.82341573  0.63591172 -0.75109216  1.45998854
 [79]  0.68874003 -0.13163983  1.39168846 -0.16028740  0.26131037  0.11535128
 [85]  1.25212528  1.01961378 -2.09834821  0.22656130  0.76002687  0.45048337
 [91] -1.22760458 -1.02221929  0.22724828 -0.90459847 -0.79184355 -0.06150404
 [97] -1.15966218 -0.50910821  0.53916986  1.36238537
> colMedians(tmp)
  [1]  1.47645820  0.34141214 -1.26808763  1.39681680  1.12744502 -0.70360037
  [7]  1.58970918  2.14547151 -0.50102482 -1.50162338  1.96141232  0.54844315
 [13] -0.55995115 -0.22262678  1.89340374  0.83294616 -1.47626642 -0.19525457
 [19] -0.78473676  0.32453177 -0.05764606 -0.82365547  0.24499220 -1.22627213
 [25] -0.23638302 -0.71369009  0.09441837 -0.89358299  0.08707250 -1.67731141
 [31] -1.09910346  2.18622433  0.22140355 -0.99312465  0.17543793  0.51338926
 [37]  0.81807283  0.85751307 -0.55357280  0.31230794  1.35859910  1.69331699
 [43] -1.20230948 -0.62354545 -1.00347113 -1.09292524  0.80475150 -0.46690058
 [49] -1.01343999  0.31401589 -0.03425370 -0.88873367  1.46385337 -1.02127528
 [55]  1.62684694 -0.05660135  1.24211407 -0.14683739  0.89435053  0.55673753
 [61] -1.67507274 -1.21139490  0.79079616 -0.75328509 -2.34347491  0.44433303
 [67]  1.93057115 -0.40692137 -0.23475039 -1.98718846 -0.36136304  1.67808923
 [73] -0.49473446 -0.03916104  0.82341573  0.63591172 -0.75109216  1.45998854
 [79]  0.68874003 -0.13163983  1.39168846 -0.16028740  0.26131037  0.11535128
 [85]  1.25212528  1.01961378 -2.09834821  0.22656130  0.76002687  0.45048337
 [91] -1.22760458 -1.02221929  0.22724828 -0.90459847 -0.79184355 -0.06150404
 [97] -1.15966218 -0.50910821  0.53916986  1.36238537
> colRanges(tmp)
         [,1]      [,2]      [,3]     [,4]     [,5]       [,6]     [,7]
[1,] 1.476458 0.3414121 -1.268088 1.396817 1.127445 -0.7036004 1.589709
[2,] 1.476458 0.3414121 -1.268088 1.396817 1.127445 -0.7036004 1.589709
         [,8]       [,9]     [,10]    [,11]     [,12]      [,13]      [,14]
[1,] 2.145472 -0.5010248 -1.501623 1.961412 0.5484432 -0.5599512 -0.2226268
[2,] 2.145472 -0.5010248 -1.501623 1.961412 0.5484432 -0.5599512 -0.2226268
        [,15]     [,16]     [,17]      [,18]      [,19]     [,20]       [,21]
[1,] 1.893404 0.8329462 -1.476266 -0.1952546 -0.7847368 0.3245318 -0.05764606
[2,] 1.893404 0.8329462 -1.476266 -0.1952546 -0.7847368 0.3245318 -0.05764606
          [,22]     [,23]     [,24]     [,25]      [,26]      [,27]     [,28]
[1,] -0.8236555 0.2449922 -1.226272 -0.236383 -0.7136901 0.09441837 -0.893583
[2,] -0.8236555 0.2449922 -1.226272 -0.236383 -0.7136901 0.09441837 -0.893583
         [,29]     [,30]     [,31]    [,32]     [,33]      [,34]     [,35]
[1,] 0.0870725 -1.677311 -1.099103 2.186224 0.2214035 -0.9931246 0.1754379
[2,] 0.0870725 -1.677311 -1.099103 2.186224 0.2214035 -0.9931246 0.1754379
         [,36]     [,37]     [,38]      [,39]     [,40]    [,41]    [,42]
[1,] 0.5133893 0.8180728 0.8575131 -0.5535728 0.3123079 1.358599 1.693317
[2,] 0.5133893 0.8180728 0.8575131 -0.5535728 0.3123079 1.358599 1.693317
         [,43]      [,44]     [,45]     [,46]     [,47]      [,48]    [,49]
[1,] -1.202309 -0.6235455 -1.003471 -1.092925 0.8047515 -0.4669006 -1.01344
[2,] -1.202309 -0.6235455 -1.003471 -1.092925 0.8047515 -0.4669006 -1.01344
         [,50]      [,51]      [,52]    [,53]     [,54]    [,55]       [,56]
[1,] 0.3140159 -0.0342537 -0.8887337 1.463853 -1.021275 1.626847 -0.05660135
[2,] 0.3140159 -0.0342537 -0.8887337 1.463853 -1.021275 1.626847 -0.05660135
        [,57]      [,58]     [,59]     [,60]     [,61]     [,62]     [,63]
[1,] 1.242114 -0.1468374 0.8943505 0.5567375 -1.675073 -1.211395 0.7907962
[2,] 1.242114 -0.1468374 0.8943505 0.5567375 -1.675073 -1.211395 0.7907962
          [,64]     [,65]    [,66]    [,67]      [,68]      [,69]     [,70]
[1,] -0.7532851 -2.343475 0.444333 1.930571 -0.4069214 -0.2347504 -1.987188
[2,] -0.7532851 -2.343475 0.444333 1.930571 -0.4069214 -0.2347504 -1.987188
         [,71]    [,72]      [,73]       [,74]     [,75]     [,76]      [,77]
[1,] -0.361363 1.678089 -0.4947345 -0.03916104 0.8234157 0.6359117 -0.7510922
[2,] -0.361363 1.678089 -0.4947345 -0.03916104 0.8234157 0.6359117 -0.7510922
        [,78]   [,79]      [,80]    [,81]      [,82]     [,83]     [,84]
[1,] 1.459989 0.68874 -0.1316398 1.391688 -0.1602874 0.2613104 0.1153513
[2,] 1.459989 0.68874 -0.1316398 1.391688 -0.1602874 0.2613104 0.1153513
        [,85]    [,86]     [,87]     [,88]     [,89]     [,90]     [,91]
[1,] 1.252125 1.019614 -2.098348 0.2265613 0.7600269 0.4504834 -1.227605
[2,] 1.252125 1.019614 -2.098348 0.2265613 0.7600269 0.4504834 -1.227605
         [,92]     [,93]      [,94]      [,95]       [,96]     [,97]      [,98]
[1,] -1.022219 0.2272483 -0.9045985 -0.7918435 -0.06150404 -1.159662 -0.5091082
[2,] -1.022219 0.2272483 -0.9045985 -0.7918435 -0.06150404 -1.159662 -0.5091082
         [,99]   [,100]
[1,] 0.5391699 1.362385
[2,] 0.5391699 1.362385
> 
> 
> Max(tmp2)
[1] 2.322982
> Min(tmp2)
[1] -2.704695
> mean(tmp2)
[1] -0.01748343
> Sum(tmp2)
[1] -1.748343
> Var(tmp2)
[1] 0.7978441
> 
> rowMeans(tmp2)
  [1]  0.16094548  0.74633902 -0.59048513  1.87191167  0.57330429 -0.92263523
  [7] -0.87992147 -0.57123278 -0.22368962 -1.72606420  0.49738390 -0.87191410
 [13]  0.14297398 -0.18898374  0.25394765 -0.69157398  0.52326540 -0.61972592
 [19] -0.20516813  1.38795287  0.80720095 -0.38132111  0.53727945 -0.05241017
 [25]  1.69050316 -0.12798031  0.93450137  0.78365638 -0.87429729  0.85986591
 [31] -0.12165996  1.07077646 -1.06107320 -0.50942521  0.11248938 -0.11643163
 [37] -0.26545233 -0.58187586  0.22758876  0.06459201  0.46830716  0.21460867
 [43]  0.91622818 -0.52472506  0.97546286  0.34420641 -0.38424454  0.69438152
 [49]  0.01068779  0.77725692 -1.59818471 -0.50894792 -1.28899574 -0.64207076
 [55] -1.83534863  1.40952666 -0.23774175 -0.97306640 -0.59728924 -1.73676485
 [61]  0.08164728  1.29702870  0.52080885  1.25865010  2.32298247 -0.23051557
 [67]  0.14726598  0.89794517  0.23352929  0.07907697 -0.54356474 -1.19502073
 [73]  0.67810759  0.02514662  0.62001252  1.14586545 -1.51697654 -1.10685419
 [79] -0.89703370  0.03899681 -0.94452813  0.13720738  0.94342651 -0.09173537
 [85]  0.01193865 -1.86115300 -0.43668274  0.62078862 -0.11120774  1.19199939
 [91] -0.21067559  1.08611286  0.07842183  0.59628427 -2.70469488 -1.09278643
 [97] -0.43415253  0.23321277  0.82479980 -0.58846023
> rowSums(tmp2)
  [1]  0.16094548  0.74633902 -0.59048513  1.87191167  0.57330429 -0.92263523
  [7] -0.87992147 -0.57123278 -0.22368962 -1.72606420  0.49738390 -0.87191410
 [13]  0.14297398 -0.18898374  0.25394765 -0.69157398  0.52326540 -0.61972592
 [19] -0.20516813  1.38795287  0.80720095 -0.38132111  0.53727945 -0.05241017
 [25]  1.69050316 -0.12798031  0.93450137  0.78365638 -0.87429729  0.85986591
 [31] -0.12165996  1.07077646 -1.06107320 -0.50942521  0.11248938 -0.11643163
 [37] -0.26545233 -0.58187586  0.22758876  0.06459201  0.46830716  0.21460867
 [43]  0.91622818 -0.52472506  0.97546286  0.34420641 -0.38424454  0.69438152
 [49]  0.01068779  0.77725692 -1.59818471 -0.50894792 -1.28899574 -0.64207076
 [55] -1.83534863  1.40952666 -0.23774175 -0.97306640 -0.59728924 -1.73676485
 [61]  0.08164728  1.29702870  0.52080885  1.25865010  2.32298247 -0.23051557
 [67]  0.14726598  0.89794517  0.23352929  0.07907697 -0.54356474 -1.19502073
 [73]  0.67810759  0.02514662  0.62001252  1.14586545 -1.51697654 -1.10685419
 [79] -0.89703370  0.03899681 -0.94452813  0.13720738  0.94342651 -0.09173537
 [85]  0.01193865 -1.86115300 -0.43668274  0.62078862 -0.11120774  1.19199939
 [91] -0.21067559  1.08611286  0.07842183  0.59628427 -2.70469488 -1.09278643
 [97] -0.43415253  0.23321277  0.82479980 -0.58846023
> 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.16094548  0.74633902 -0.59048513  1.87191167  0.57330429 -0.92263523
  [7] -0.87992147 -0.57123278 -0.22368962 -1.72606420  0.49738390 -0.87191410
 [13]  0.14297398 -0.18898374  0.25394765 -0.69157398  0.52326540 -0.61972592
 [19] -0.20516813  1.38795287  0.80720095 -0.38132111  0.53727945 -0.05241017
 [25]  1.69050316 -0.12798031  0.93450137  0.78365638 -0.87429729  0.85986591
 [31] -0.12165996  1.07077646 -1.06107320 -0.50942521  0.11248938 -0.11643163
 [37] -0.26545233 -0.58187586  0.22758876  0.06459201  0.46830716  0.21460867
 [43]  0.91622818 -0.52472506  0.97546286  0.34420641 -0.38424454  0.69438152
 [49]  0.01068779  0.77725692 -1.59818471 -0.50894792 -1.28899574 -0.64207076
 [55] -1.83534863  1.40952666 -0.23774175 -0.97306640 -0.59728924 -1.73676485
 [61]  0.08164728  1.29702870  0.52080885  1.25865010  2.32298247 -0.23051557
 [67]  0.14726598  0.89794517  0.23352929  0.07907697 -0.54356474 -1.19502073
 [73]  0.67810759  0.02514662  0.62001252  1.14586545 -1.51697654 -1.10685419
 [79] -0.89703370  0.03899681 -0.94452813  0.13720738  0.94342651 -0.09173537
 [85]  0.01193865 -1.86115300 -0.43668274  0.62078862 -0.11120774  1.19199939
 [91] -0.21067559  1.08611286  0.07842183  0.59628427 -2.70469488 -1.09278643
 [97] -0.43415253  0.23321277  0.82479980 -0.58846023
> rowMin(tmp2)
  [1]  0.16094548  0.74633902 -0.59048513  1.87191167  0.57330429 -0.92263523
  [7] -0.87992147 -0.57123278 -0.22368962 -1.72606420  0.49738390 -0.87191410
 [13]  0.14297398 -0.18898374  0.25394765 -0.69157398  0.52326540 -0.61972592
 [19] -0.20516813  1.38795287  0.80720095 -0.38132111  0.53727945 -0.05241017
 [25]  1.69050316 -0.12798031  0.93450137  0.78365638 -0.87429729  0.85986591
 [31] -0.12165996  1.07077646 -1.06107320 -0.50942521  0.11248938 -0.11643163
 [37] -0.26545233 -0.58187586  0.22758876  0.06459201  0.46830716  0.21460867
 [43]  0.91622818 -0.52472506  0.97546286  0.34420641 -0.38424454  0.69438152
 [49]  0.01068779  0.77725692 -1.59818471 -0.50894792 -1.28899574 -0.64207076
 [55] -1.83534863  1.40952666 -0.23774175 -0.97306640 -0.59728924 -1.73676485
 [61]  0.08164728  1.29702870  0.52080885  1.25865010  2.32298247 -0.23051557
 [67]  0.14726598  0.89794517  0.23352929  0.07907697 -0.54356474 -1.19502073
 [73]  0.67810759  0.02514662  0.62001252  1.14586545 -1.51697654 -1.10685419
 [79] -0.89703370  0.03899681 -0.94452813  0.13720738  0.94342651 -0.09173537
 [85]  0.01193865 -1.86115300 -0.43668274  0.62078862 -0.11120774  1.19199939
 [91] -0.21067559  1.08611286  0.07842183  0.59628427 -2.70469488 -1.09278643
 [97] -0.43415253  0.23321277  0.82479980 -0.58846023
> 
> colMeans(tmp2)
[1] -0.01748343
> colSums(tmp2)
[1] -1.748343
> colVars(tmp2)
[1] 0.7978441
> colSd(tmp2)
[1] 0.8932212
> colMax(tmp2)
[1] 2.322982
> colMin(tmp2)
[1] -2.704695
> colMedians(tmp2)
[1] 0.01854264
> colRanges(tmp2)
          [,1]
[1,] -2.704695
[2,]  2.322982
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.2036185 -2.9051500  3.1846348  2.9028797 -3.0942672  0.5429374
 [7]  3.4942109 -0.4927915  3.1068220 -1.6152182
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1427319
[2,] -0.8707015
[3,]  0.4002428
[4,]  0.8241730
[5,]  0.9005954
> 
> rowApply(tmp,sum)
 [1] -5.7987265  3.6256069  1.3908545  5.3276203 -1.6910207  3.1582242
 [7] -0.7672006 -2.4008030  0.4487652  0.6271189
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    9    8    4    3    6    2    8    5     1
 [2,]    9    5    6    1    1    4    5    5    1     8
 [3,]    6   10    2    5    8    3    4    9    6     9
 [4,]    2    2   10    6   10    5    7   10    4     3
 [5,]    3    6    1    3    9    1    3    2    9    10
 [6,]    4    3    7    7    7    7    8    1    8     5
 [7,]    8    8    5   10    5    9    9    7    2     6
 [8,]    5    7    4    8    2   10    6    3    3     2
 [9,]   10    4    9    9    4    8    1    6    7     7
[10,]    7    1    3    2    6    2   10    4   10     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.7333906 -0.7187850 -3.7048727 -1.7522942 -0.7489923 -1.0831639
 [7] -2.5380966 -0.9282080  2.2992085 -2.8425508 -0.8638862  5.1992271
[13] -3.3146698 -1.1079211 -1.0066007  5.4452454 -3.1185116 -2.0860594
[19]  0.1706397  0.4368673
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.5602582
[2,] -0.2759425
[3,] -0.2449072
[4,]  0.3961214
[5,]  1.4183772
> 
> rowApply(tmp,sum)
[1]  0.6618533 -2.6040477 -9.6085057 -5.8546182  5.8752844
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    7   10   13   20   11
[2,]   18    3    3   10   10
[3,]    5   12    9    8    2
[4,]   19    9    7    2   13
[5,]   13    8   11    7   12
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -0.5602582  1.28680346 -0.9645792  1.2883300  0.2495346 -1.4309427
[2,] -0.2449072 -0.81371356 -0.1541456 -0.2536979 -0.3061966 -0.3421048
[3,] -0.2759425 -1.48524987 -0.7361854 -0.8157515 -0.5946121  0.6969905
[4,]  1.4183772  0.04646916 -0.4824419 -2.6821219 -0.6445629  0.1169903
[5,]  0.3961214  0.24690583 -1.3675206  0.7109470  0.5468447 -0.1240973
           [,7]        [,8]       [,9]       [,10]       [,11]      [,12]
[1,]  0.2126493  1.21784761  1.2840400 -1.13871833 -1.01464121 -0.3048616
[2,]  0.9597158 -0.01230732  0.5024105 -0.77961609  0.73031695  1.3915872
[3,] -1.0217446  0.04853130 -0.8248135 -0.05474621  0.03864026  2.5033129
[4,] -1.1262207 -1.25926689  0.5755528 -2.79623915 -0.82872077  0.7550370
[5,] -1.5624963 -0.92301271  0.7620186  1.92676898  0.21051852  0.8541517
           [,13]      [,14]      [,15]      [,16]      [,17]       [,18]
[1,] -1.11792110  0.3037116 -0.2899934 2.19502160 -0.2911051 -0.85058843
[2,] -1.92855059 -0.1832143  0.3283231 0.04693966  0.9556668 -0.60553016
[3,] -0.17298001 -1.3926761 -2.7392155 0.84658179 -1.7673466 -0.79369291
[4,] -0.04471272  0.9515920  0.5967817 0.58630921 -1.6548718  0.17834035
[5,] -0.05050542 -0.7873342  1.0975034 1.77039317 -0.3608549 -0.01458825
          [,19]      [,20]
[1,] -0.0996640  0.6871884
[2,] -0.7652816 -1.1297420
[3,] -0.6946369 -0.3729689
[4,]  0.1572503  0.2818408
[5,]  1.5729719  0.9705489
> 
> 
> 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.14-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.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  639  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  550  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1       col2       col3      col4       col5      col6      col7
row1 1.134538 -0.5923307 -0.1816431 0.2660417 -0.7465161 0.3422961 -1.311357
          col8      col9     col10     col11    col12    col13    col14
row1 0.3058668 0.1645938 0.1579187 0.2771277 2.093472 1.054771 1.440773
         col15     col16    col17      col18    col19     col20
row1 -0.762363 0.4850025 1.055431 -0.6116995 1.218865 -1.690987
> tmp[,"col10"]
          col10
row1  0.1579187
row2 -0.1626779
row3 -0.9612716
row4  0.8071988
row5  1.9084120
> tmp[c("row1","row5"),]
          col1       col2       col3      col4       col5      col6      col7
row1  1.134538 -0.5923307 -0.1816431 0.2660417 -0.7465161 0.3422961 -1.311357
row5 -1.069517 -0.1139450  0.9193851 0.7044172  1.0584400 0.8462504  1.115475
           col8      col9     col10     col11     col12     col13     col14
row1  0.3058668 0.1645938 0.1579187 0.2771277 2.0934720  1.054771 1.4407727
row5 -0.2077867 0.4051476 1.9084120 0.1423689 0.3589205 -1.133217 0.9956742
          col15     col16     col17      col18      col19      col20
row1 -0.7623630 0.4850025 1.0554313 -0.6116995  1.2188649 -1.6909865
row5  0.6975455 1.4285230 0.1572232  0.8389884 -0.3208874 -0.2540058
> tmp[,c("col6","col20")]
           col6      col20
row1  0.3422961 -1.6909865
row2  0.7166167  0.9138544
row3 -1.4504045 -0.9674546
row4 -0.5162199  0.2687614
row5  0.8462504 -0.2540058
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.3422961 -1.6909865
row5 0.8462504 -0.2540058
> 
> 
> 
> 
> 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.39911 49.78605 49.9882 49.90703 52.76113 106.4639 49.30601 49.596
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.12047 51.56138 48.73793 49.67474 51.16177 48.29462 49.98027 51.50957
        col17    col18    col19    col20
row1 49.03118 49.20621 50.25384 104.0184
> tmp[,"col10"]
        col10
row1 51.56138
row2 30.02598
row3 30.97107
row4 31.08735
row5 49.70902
> tmp[c("row1","row5"),]
         col1     col2    col3     col4     col5     col6     col7     col8
row1 50.39911 49.78605 49.9882 49.90703 52.76113 106.4639 49.30601 49.59600
row5 50.18819 49.48850 47.8489 50.36738 48.70986 105.5893 52.16831 50.40286
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.12047 51.56138 48.73793 49.67474 51.16177 48.29462 49.98027 51.50957
row5 51.69057 49.70902 50.59590 50.83756 50.04665 49.52670 51.00166 50.35956
        col17    col18    col19    col20
row1 49.03118 49.20621 50.25384 104.0184
row5 47.33528 49.70934 51.21785 105.4037
> tmp[,c("col6","col20")]
          col6     col20
row1 106.46386 104.01837
row2  74.51352  77.04080
row3  75.87161  74.72711
row4  74.72633  74.51125
row5 105.58934 105.40370
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.4639 104.0184
row5 105.5893 105.4037
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.4639 104.0184
row5 105.5893 105.4037
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  2.95972969
[2,]  1.96803887
[3,]  0.03591941
[4,]  0.44030791
[5,] -0.09960218
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.6413004  0.5686564
[2,]  0.6255331  2.3430337
[3,]  1.4815334 -0.8997047
[4,] -0.6489051 -0.7315041
[5,]  0.6546100  1.0103246
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] 1.10171616 -0.7310872
[2,] 0.09387949 -0.7603363
[3,] 0.70618462 -1.1576324
[4,] 0.73954423 -0.7697644
[5,] 1.33642022 -2.3034851
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.101716
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] 1.10171616
[2,] 0.09387949
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
row3 -1.739846  0.3208581  0.9425562 -0.1764555  0.8308484 -1.3145175
row1  2.840774 -0.4700222 -0.5326757 -0.5871983 -1.1214914 -0.9756424
           [,7]      [,8]       [,9]       [,10]      [,11]      [,12]
row3  0.3069430 0.3300835 -0.5043995  0.02102789 -0.5176034 -0.4420901
row1 -0.8330745 0.8484105  1.1570301 -0.71763450 -0.9621175  0.2272178
         [,13]      [,14]      [,15]      [,16]        [,17]     [,18]
row3  0.216183  2.0264127 -0.4377050 -1.1568078 -1.598101268 0.5488106
row1 -1.025969 -0.5012767  0.4078797  0.4392477 -0.005490846 0.5075002
         [,19]      [,20]
row3 0.2537844 -0.1617679
row1 0.4864908  2.0817326
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]     [,5]       [,6]     [,7]
row2 -1.182581 0.1312161 0.7415275 0.3293227 1.127574 -0.8786396 1.262209
          [,8]      [,9]      [,10]
row2 -1.255076 0.0356578 -0.8095076
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]       [,3]      [,4]       [,5]      [,6]      [,7]
row5 0.7649589 0.916942 -0.4205701 0.9677418 -0.3911871 -1.556802 -1.707215
           [,8]       [,9]     [,10]     [,11]     [,12]     [,13]      [,14]
row5 -0.5629331 -0.9544669 0.8544623 0.4964537 0.3503735 -2.445956 -0.1892284
          [,15]      [,16]      [,17]     [,18]     [,19]    [,20]
row5 0.04328235 -0.7964785 -0.2449463 0.2821954 0.6454814 1.001917
> 
> 
> 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: 0x02fe8318>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c2282f2d" 
 [2] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c69bb3fe7"
 [3] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c761da6"  
 [4] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c7c8a4cab"
 [5] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c445682a" 
 [6] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196ce1d60f2" 
 [7] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c61797a7a"
 [8] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c5938512a"
 [9] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c60fe2c1b"
[10] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c6a072da1"
[11] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c7b7f615a"
[12] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c62b25ba2"
[13] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c69877d8e"
[14] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c6e3149e1"
[15] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM196c4cf25a9d"
> 
> 
> ### 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: 0x028b2080>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x028b2080>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.14-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x028b2080>
> rowMedians(tmp)
  [1]  0.3437909062  0.3030680057 -0.3043744997 -0.1156366781 -0.3504236806
  [6]  0.8449162071 -0.0784292649  0.1175367339  0.7914011047  0.5246282356
 [11] -0.3870653815 -0.0131423457 -0.2132405206  0.0792983911 -0.1964427161
 [16] -0.5953809064 -0.1398255810 -0.2188208031 -0.3890852958 -0.2114769821
 [21] -0.0827569036 -0.0001824704  0.0691284792 -0.0677531279  0.0607433224
 [26]  0.2128002285 -0.3094226557  0.3816033273 -0.0095893805 -0.3313524299
 [31]  0.0549361518 -0.0168124318 -0.1782534162 -0.1660614255 -0.1826248269
 [36] -0.1889482321 -0.2837641996 -0.6967147508 -0.1382300796 -0.4908455649
 [41] -0.1970148396  0.2522170004 -0.2548459016 -0.3760555338 -0.3836710115
 [46]  0.1526275623 -0.4563202647  0.0197236693  0.4415531745  0.3852741220
 [51]  0.2000720143  0.1129828211  0.0750092142 -0.0250287515  0.3415283119
 [56] -0.3421793293 -0.0547335324  0.2069936075 -0.1209896916 -0.3348647118
 [61]  0.0367180336 -0.4141545514  0.2825178690 -0.2397539826  0.1650012400
 [66] -0.3228397931  0.2768065212  0.1218283542 -0.3046060753 -0.2976789777
 [71] -0.4185757462 -0.1623580030 -0.0795783440 -0.1702321664  0.3856942070
 [76] -0.1163750552 -0.2962271435 -0.2427666247  0.0029916061  0.2144480808
 [81] -0.0531736379 -0.2949240285  0.0908055288 -0.0310206311 -0.4034962827
 [86] -0.0466343897 -0.6355671834 -0.1354741066  0.3962218198 -0.2326115332
 [91]  0.1616096638 -0.0541635304  0.0733106844 -0.2676024496  0.4399264521
 [96]  0.1657579613  0.1894066632  0.8441469978  0.1782181559  0.0740173805
[101]  0.6817414409  0.1105701679 -0.1518625577 -0.2414645203  0.1286259677
[106]  0.5174954167 -0.4469595125 -0.1742368548  0.3546472486  0.2370492348
[111] -0.2086305978 -0.0358134734 -0.1128620228  0.6396314236  0.1155357310
[116]  0.5445152256  0.2635932962 -0.0364971071 -0.7538403422 -0.0626212010
[121]  0.6818564669 -0.1818967602 -0.6346489079 -0.1631745062 -0.3508387821
[126]  0.1984349912  0.1757159504  0.4392694300 -0.5036599317 -0.0192105572
[131]  0.0548187940  0.3156259784  0.2001971131  0.4077110589 -0.2737548591
[136]  0.2462737839 -0.3091499437  0.2229736490  0.0419779126  0.4321359626
[141] -0.1284460375  0.6376803444 -0.2237203695 -0.7664240979  0.4275648384
[146]  0.0322015916  0.0797915683 -0.1606352327 -0.1236167499 -0.1320036179
[151]  0.2786045457 -0.0896985051  0.1474647829  0.0327733969  0.5429871760
[156]  0.2747921511 -0.3707394062 -0.1582723021  0.2884843899  0.2775657767
[161]  0.4984147228  0.0610237903 -0.6234545837 -0.1451650566  0.4251190384
[166] -0.3763008229  0.5593602355 -0.0518139031  0.6699684632 -0.1867859399
[171]  0.0241341516  0.4286534354 -0.4869611482  0.2778669074 -0.2952404771
[176]  0.4802133299 -0.1195728908  0.1730603232 -0.0224111066 -0.0064419592
[181] -0.0484180356 -0.3815127384  0.6387585321 -0.2638393095  0.0857745537
[186] -0.1437916946 -0.1634323686  0.1206826092 -0.4698546855  0.1666817149
[191] -0.0464976526  0.3130820671 -0.5009828686 -0.6358211749 -0.1954563137
[196] -0.1615535400 -0.2579298356 -0.0210912563 -0.2316761035  0.1231627334
[201] -0.3986118171 -0.0704408876 -0.2181400524 -0.0506174042  0.6107380518
[206]  0.3099611204 -0.2214588871  0.0843241437  0.8866754759 -0.0572668375
[211]  0.1344056444  0.6326237384  0.1526251551  0.2838036099  0.2145736995
[216] -0.2530062218  0.5123002804  0.2495105170 -0.2588100977  0.3784727630
[221] -0.0240493403  0.1189414045  0.5350155493  0.0699869027  0.1230085855
[226] -0.2975998756 -0.5691061737 -0.1410681867  0.1144868017 -0.0117765821
> 
> proc.time()
   user  system elapsed 
   3.09    7.25   11.31 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.14-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 436755 23.4     924417 49.4   646908 34.6
Vcells 756020  5.8    8388608 64.0  1962980 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] "Tue Apr 12 16:41:32 2022"
> 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] "Tue Apr 12 16:41:32 2022"
> 
> 
> 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: 0x000000000627be18>
> 
> 
> 
> 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] "Tue Apr 12 16:41:34 2022"
> 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] "Tue Apr 12 16:41:35 2022"
> 
> ColMode(tmp2)
<pointer: 0x000000000627be18>
> 
> 
> 
> ### 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.8012568 -1.2018989 -0.2094496  0.76299924
[2,] -0.3070747 -0.3124583 -2.0784301 -0.18517594
[3,]  0.4274119  1.0220778  0.7927138  0.19305826
[4,] -1.7686196  0.1210299 -0.4475475 -0.07796622
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-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.8012568 1.2018989 0.2094496 0.76299924
[2,]  0.3070747 0.3124583 2.0784301 0.18517594
[3,]  0.4274119 1.0220778 0.7927138 0.19305826
[4,]  1.7686196 0.1210299 0.4475475 0.07796622
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-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.9900579 1.0963115 0.4576566 0.8734983
[2,] 0.5541432 0.5589797 1.4416761 0.4303207
[3,] 0.6537675 1.0109786 0.8903448 0.4393840
[4,] 1.3298946 0.3478935 0.6689899 0.2792243
> 
> 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.14-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.70184 37.16501 29.78602 34.49798
[2,]  30.84851 30.90225 41.49519 29.48838
[3,]  31.96509 36.13186 34.69616 29.58690
[4,]  40.06757 28.59997 32.13745 27.87021
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000004f85fe0>
> exp(tmp5)
<pointer: 0x0000000004f85fe0>
> log(tmp5,2)
<pointer: 0x0000000004f85fe0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.6874
> Min(tmp5)
[1] 54.84008
> mean(tmp5)
[1] 73.70786
> Sum(tmp5)
[1] 14741.57
> Var(tmp5)
[1] 850.7717
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.15419 71.63648 74.52967 72.10670 71.96192 71.55368 72.21182 71.73424
 [9] 67.82794 71.36192
> rowSums(tmp5)
 [1] 1843.084 1432.730 1490.593 1442.134 1439.238 1431.074 1444.236 1434.685
 [9] 1356.559 1427.238
> rowVars(tmp5)
 [1] 7877.70573   61.03704   89.98400   87.50201   79.10345   46.99566
 [7]   48.22228   76.68003   51.85133   68.79531
> rowSd(tmp5)
 [1] 88.756440  7.812620  9.485990  9.354251  8.894012  6.855338  6.944226
 [8]  8.756714  7.200786  8.294294
> rowMax(tmp5)
 [1] 467.68743  86.36680  93.16191  85.17825  84.91725  84.14420  83.65845
 [8]  84.46202  82.40468  88.36384
> rowMin(tmp5)
 [1] 59.14676 61.37621 57.15926 58.00819 55.91513 56.94656 60.96724 54.84008
 [9] 57.42078 55.84360
> 
> colMeans(tmp5)
 [1] 111.81404  72.53245  67.24824  65.32457  70.52059  70.90910  78.26687
 [8]  71.56001  73.88620  75.22058  71.65471  70.97524  74.84376  70.33023
[15]  73.28846  71.35596  72.59408  71.26608  71.32177  69.24417
> colSums(tmp5)
 [1] 1118.1404  725.3245  672.4824  653.2457  705.2059  709.0910  782.6687
 [8]  715.6001  738.8620  752.2058  716.5471  709.7524  748.4376  703.3023
[15]  732.8846  713.5596  725.9408  712.6608  713.2177  692.4417
> colVars(tmp5)
 [1] 15707.84977    84.97735   100.45065    38.31438    68.96010    65.58967
 [7]    64.78869    35.05671    59.98738    68.20418    61.00104    61.71254
[13]    94.70405    46.84942    69.83316    72.46523    86.65466    40.85052
[19]    82.75728    40.40426
> colSd(tmp5)
 [1] 125.330961   9.218316  10.022507   6.189861   8.304222   8.098745
 [7]   8.049142   5.920870   7.745152   8.258582   7.810316   7.855733
[13]   9.731601   6.844664   8.356624   8.512651   9.308848   6.391441
[19]   9.097103   6.356435
> colMax(tmp5)
 [1] 467.68743  83.99745  86.36680  76.26864  84.47094  81.47789  88.33641
 [8]  84.91725  84.72977  87.05173  83.72387  80.96301  93.16191  79.69577
[15]  84.46202  83.65845  83.44276  81.51826  87.17878  78.46410
> colMin(tmp5)
 [1] 62.13446 59.52708 55.91513 58.00819 56.94656 54.84008 64.96324 62.93504
 [9] 55.84360 64.39274 59.45928 59.14676 59.62525 57.15926 56.32789 59.88002
[17] 57.42078 60.96724 61.53069 60.06913
> 
> 
> ### 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.15419 71.63648 74.52967       NA 71.96192 71.55368 72.21182 71.73424
 [9] 67.82794 71.36192
> rowSums(tmp5)
 [1] 1843.084 1432.730 1490.593       NA 1439.238 1431.074 1444.236 1434.685
 [9] 1356.559 1427.238
> rowVars(tmp5)
 [1] 7877.70573   61.03704   89.98400   82.37110   79.10345   46.99566
 [7]   48.22228   76.68003   51.85133   68.79531
> rowSd(tmp5)
 [1] 88.756440  7.812620  9.485990  9.075853  8.894012  6.855338  6.944226
 [8]  8.756714  7.200786  8.294294
> rowMax(tmp5)
 [1] 467.68743  86.36680  93.16191        NA  84.91725  84.14420  83.65845
 [8]  84.46202  82.40468  88.36384
> rowMin(tmp5)
 [1] 59.14676 61.37621 57.15926       NA 55.91513 56.94656 60.96724 54.84008
 [9] 57.42078 55.84360
> 
> colMeans(tmp5)
 [1] 111.81404  72.53245  67.24824  65.32457  70.52059  70.90910  78.26687
 [8]  71.56001  73.88620        NA  71.65471  70.97524  74.84376  70.33023
[15]  73.28846  71.35596  72.59408  71.26608  71.32177  69.24417
> colSums(tmp5)
 [1] 1118.1404  725.3245  672.4824  653.2457  705.2059  709.0910  782.6687
 [8]  715.6001  738.8620        NA  716.5471  709.7524  748.4376  703.3023
[15]  732.8846  713.5596  725.9408  712.6608  713.2177  692.4417
> colVars(tmp5)
 [1] 15707.84977    84.97735   100.45065    38.31438    68.96010    65.58967
 [7]    64.78869    35.05671    59.98738          NA    61.00104    61.71254
[13]    94.70405    46.84942    69.83316    72.46523    86.65466    40.85052
[19]    82.75728    40.40426
> colSd(tmp5)
 [1] 125.330961   9.218316  10.022507   6.189861   8.304222   8.098745
 [7]   8.049142   5.920870   7.745152         NA   7.810316   7.855733
[13]   9.731601   6.844664   8.356624   8.512651   9.308848   6.391441
[19]   9.097103   6.356435
> colMax(tmp5)
 [1] 467.68743  83.99745  86.36680  76.26864  84.47094  81.47789  88.33641
 [8]  84.91725  84.72977        NA  83.72387  80.96301  93.16191  79.69577
[15]  84.46202  83.65845  83.44276  81.51826  87.17878  78.46410
> colMin(tmp5)
 [1] 62.13446 59.52708 55.91513 58.00819 56.94656 54.84008 64.96324 62.93504
 [9] 55.84360       NA 59.45928 59.14676 59.62525 57.15926 56.32789 59.88002
[17] 57.42078 60.96724 61.53069 60.06913
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.6874
> Min(tmp5,na.rm=TRUE)
[1] 54.84008
> mean(tmp5,na.rm=TRUE)
[1] 73.65022
> Sum(tmp5,na.rm=TRUE)
[1] 14656.39
> Var(tmp5,na.rm=TRUE)
[1] 854.4007
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.15419 71.63648 74.52967 71.41873 71.96192 71.55368 72.21182 71.73424
 [9] 67.82794 71.36192
> rowSums(tmp5,na.rm=TRUE)
 [1] 1843.084 1432.730 1490.593 1356.956 1439.238 1431.074 1444.236 1434.685
 [9] 1356.559 1427.238
> rowVars(tmp5,na.rm=TRUE)
 [1] 7877.70573   61.03704   89.98400   82.37110   79.10345   46.99566
 [7]   48.22228   76.68003   51.85133   68.79531
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.756440  7.812620  9.485990  9.075853  8.894012  6.855338  6.944226
 [8]  8.756714  7.200786  8.294294
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.68743  86.36680  93.16191  83.74880  84.91725  84.14420  83.65845
 [8]  84.46202  82.40468  88.36384
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.14676 61.37621 57.15926 58.00819 55.91513 56.94656 60.96724 54.84008
 [9] 57.42078 55.84360
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.81404  72.53245  67.24824  65.32457  70.52059  70.90910  78.26687
 [8]  71.56001  73.88620  74.11418  71.65471  70.97524  74.84376  70.33023
[15]  73.28846  71.35596  72.59408  71.26608  71.32177  69.24417
> colSums(tmp5,na.rm=TRUE)
 [1] 1118.1404  725.3245  672.4824  653.2457  705.2059  709.0910  782.6687
 [8]  715.6001  738.8620  667.0276  716.5471  709.7524  748.4376  703.3023
[15]  732.8846  713.5596  725.9408  712.6608  713.2177  692.4417
> colVars(tmp5,na.rm=TRUE)
 [1] 15707.84977    84.97735   100.45065    38.31438    68.96010    65.58967
 [7]    64.78869    35.05671    59.98738    62.95815    61.00104    61.71254
[13]    94.70405    46.84942    69.83316    72.46523    86.65466    40.85052
[19]    82.75728    40.40426
> colSd(tmp5,na.rm=TRUE)
 [1] 125.330961   9.218316  10.022507   6.189861   8.304222   8.098745
 [7]   8.049142   5.920870   7.745152   7.934617   7.810316   7.855733
[13]   9.731601   6.844664   8.356624   8.512651   9.308848   6.391441
[19]   9.097103   6.356435
> colMax(tmp5,na.rm=TRUE)
 [1] 467.68743  83.99745  86.36680  76.26864  84.47094  81.47789  88.33641
 [8]  84.91725  84.72977  87.05173  83.72387  80.96301  93.16191  79.69577
[15]  84.46202  83.65845  83.44276  81.51826  87.17878  78.46410
> colMin(tmp5,na.rm=TRUE)
 [1] 62.13446 59.52708 55.91513 58.00819 56.94656 54.84008 64.96324 62.93504
 [9] 55.84360 64.39274 59.45928 59.14676 59.62525 57.15926 56.32789 59.88002
[17] 57.42078 60.96724 61.53069 60.06913
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.15419 71.63648 74.52967      NaN 71.96192 71.55368 72.21182 71.73424
 [9] 67.82794 71.36192
> rowSums(tmp5,na.rm=TRUE)
 [1] 1843.084 1432.730 1490.593    0.000 1439.238 1431.074 1444.236 1434.685
 [9] 1356.559 1427.238
> rowVars(tmp5,na.rm=TRUE)
 [1] 7877.70573   61.03704   89.98400         NA   79.10345   46.99566
 [7]   48.22228   76.68003   51.85133   68.79531
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.756440  7.812620  9.485990        NA  8.894012  6.855338  6.944226
 [8]  8.756714  7.200786  8.294294
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.68743  86.36680  93.16191        NA  84.91725  84.14420  83.65845
 [8]  84.46202  82.40468  88.36384
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.14676 61.37621 57.15926       NA 55.91513 56.94656 60.96724 54.84008
 [9] 57.42078 55.84360
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.97167  73.97749  67.28806  66.13750  71.11663  71.15931  77.65776
 [8]  71.61689  73.71024       NaN  70.31369  70.39349  74.22186  70.78179
[15]  72.89351  72.39885  71.38867  70.90035  72.40966  70.26362
> colSums(tmp5,na.rm=TRUE)
 [1] 1034.7450  665.7974  605.5926  595.2375  640.0497  640.4338  698.9199
 [8]  644.5520  663.3922    0.0000  632.8232  633.5414  667.9967  637.0361
[15]  656.0416  651.5897  642.4981  638.1031  651.6870  632.3726
> colVars(tmp5,na.rm=TRUE)
 [1] 17559.16159    72.10791   112.98914    35.66904    73.58334    73.08408
 [7]    68.71344    39.40240    67.13749          NA    48.39496    65.61932
[13]   102.19093    50.41166    76.80745    69.28761    81.14013    44.45199
[19]    79.78734    33.76293
> colSd(tmp5,na.rm=TRUE)
 [1] 132.510987   8.491638  10.629635   5.972356   8.578073   8.548923
 [7]   8.289357   6.277133   8.193747         NA   6.956649   8.100575
[13]  10.108953   7.100117   8.763986   8.323918   9.007782   6.667233
[19]   8.932376   5.810588
> colMax(tmp5,na.rm=TRUE)
 [1] 467.68743  83.99745  86.36680  76.26864  84.47094  81.47789  88.33641
 [8]  84.91725  84.72977      -Inf  80.68089  80.96301  93.16191  79.69577
[15]  84.46202  83.65845  82.58547  81.51826  87.17878  78.46410
> colMin(tmp5,na.rm=TRUE)
 [1] 62.13446 61.91604 55.91513 61.37621 56.94656 54.84008 64.96324 62.93504
 [9] 55.84360      Inf 59.45928 59.14676 59.62525 57.15926 56.32789 59.88002
[17] 57.42078 60.96724 62.76710 62.92916
> 
> 
> 
> 
> 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] 283.2231 505.2269 353.5838 293.9910 114.4784 271.4908 296.7657 261.5559
 [9] 162.8281 164.2066
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 283.2231 505.2269 353.5838 293.9910 114.4784 271.4908 296.7657 261.5559
 [9] 162.8281 164.2066
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -2.842171e-14  5.684342e-14  5.684342e-14 -2.842171e-14  1.136868e-13
 [6] -1.136868e-13 -5.684342e-14  5.684342e-14 -5.684342e-14 -5.684342e-14
[11] -1.989520e-13  1.705303e-13  0.000000e+00  1.136868e-13 -2.842171e-14
[16]  5.684342e-14  5.684342e-14  2.273737e-13  7.105427e-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)
+ }
1   9 
3   2 
3   19 
8   15 
10   5 
1   5 
9   13 
2   8 
7   15 
2   18 
2   3 
6   16 
10   17 
10   4 
3   10 
5   9 
5   8 
5   17 
1   20 
7   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.547588
> Min(tmp)
[1] -2.163926
> mean(tmp)
[1] -0.09097586
> Sum(tmp)
[1] -9.097586
> Var(tmp)
[1] 0.8163695
> 
> rowMeans(tmp)
[1] -0.09097586
> rowSums(tmp)
[1] -9.097586
> rowVars(tmp)
[1] 0.8163695
> rowSd(tmp)
[1] 0.9035317
> rowMax(tmp)
[1] 2.547588
> rowMin(tmp)
[1] -2.163926
> 
> colMeans(tmp)
  [1]  0.15253631  0.47779878  0.14070865  0.67386855 -0.72187676 -0.21002049
  [7] -0.71348468  0.09487769  1.63381747  0.92319794  0.96459974 -1.21542422
 [13]  0.84544916 -0.82186414 -1.23333252 -1.30235952  0.16167603  0.02762809
 [19] -0.36908522 -0.76845183 -1.02138589  0.80927035 -1.47424451 -1.09488983
 [25]  0.40045650 -1.34536154  0.15849371  1.07146566 -1.65294608  0.66196202
 [31]  0.25376160 -0.71002914 -1.18556829 -0.16969788 -0.90726534  0.06092831
 [37]  1.19562116 -0.02487887  0.77856116  0.26972368  0.47893061 -0.39921738
 [43] -0.73229298 -0.04197176 -0.24139540  0.30048078  0.90835013  0.76966465
 [49] -0.04081873 -0.42262841 -0.67440148  0.42670150 -0.68462905  0.22400733
 [55] -0.20509350 -1.90106975  0.04769145 -0.36707274  0.49820957 -1.00488442
 [61]  1.24012600  2.54758785  0.50742962 -0.27947589  1.72814567  0.77052722
 [67]  0.30631893 -1.30848686 -1.69576812  0.15675685 -0.18903201 -1.14370044
 [73] -0.09060262  0.71239067 -0.29167817 -0.90380176 -0.77667909  0.44987139
 [79] -0.02941063 -0.13459267 -2.16392607 -0.19832624 -0.95397321  0.78042866
 [85]  0.38960984 -0.33848246  0.54757787 -0.17423553 -0.04054971  0.27433906
 [91] -1.67718964  2.05087455 -0.30708644  1.49652677  0.01671186  1.28421511
 [97] -0.28636036 -0.40142951 -2.14890527 -0.57612738
> colSums(tmp)
  [1]  0.15253631  0.47779878  0.14070865  0.67386855 -0.72187676 -0.21002049
  [7] -0.71348468  0.09487769  1.63381747  0.92319794  0.96459974 -1.21542422
 [13]  0.84544916 -0.82186414 -1.23333252 -1.30235952  0.16167603  0.02762809
 [19] -0.36908522 -0.76845183 -1.02138589  0.80927035 -1.47424451 -1.09488983
 [25]  0.40045650 -1.34536154  0.15849371  1.07146566 -1.65294608  0.66196202
 [31]  0.25376160 -0.71002914 -1.18556829 -0.16969788 -0.90726534  0.06092831
 [37]  1.19562116 -0.02487887  0.77856116  0.26972368  0.47893061 -0.39921738
 [43] -0.73229298 -0.04197176 -0.24139540  0.30048078  0.90835013  0.76966465
 [49] -0.04081873 -0.42262841 -0.67440148  0.42670150 -0.68462905  0.22400733
 [55] -0.20509350 -1.90106975  0.04769145 -0.36707274  0.49820957 -1.00488442
 [61]  1.24012600  2.54758785  0.50742962 -0.27947589  1.72814567  0.77052722
 [67]  0.30631893 -1.30848686 -1.69576812  0.15675685 -0.18903201 -1.14370044
 [73] -0.09060262  0.71239067 -0.29167817 -0.90380176 -0.77667909  0.44987139
 [79] -0.02941063 -0.13459267 -2.16392607 -0.19832624 -0.95397321  0.78042866
 [85]  0.38960984 -0.33848246  0.54757787 -0.17423553 -0.04054971  0.27433906
 [91] -1.67718964  2.05087455 -0.30708644  1.49652677  0.01671186  1.28421511
 [97] -0.28636036 -0.40142951 -2.14890527 -0.57612738
> 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.15253631  0.47779878  0.14070865  0.67386855 -0.72187676 -0.21002049
  [7] -0.71348468  0.09487769  1.63381747  0.92319794  0.96459974 -1.21542422
 [13]  0.84544916 -0.82186414 -1.23333252 -1.30235952  0.16167603  0.02762809
 [19] -0.36908522 -0.76845183 -1.02138589  0.80927035 -1.47424451 -1.09488983
 [25]  0.40045650 -1.34536154  0.15849371  1.07146566 -1.65294608  0.66196202
 [31]  0.25376160 -0.71002914 -1.18556829 -0.16969788 -0.90726534  0.06092831
 [37]  1.19562116 -0.02487887  0.77856116  0.26972368  0.47893061 -0.39921738
 [43] -0.73229298 -0.04197176 -0.24139540  0.30048078  0.90835013  0.76966465
 [49] -0.04081873 -0.42262841 -0.67440148  0.42670150 -0.68462905  0.22400733
 [55] -0.20509350 -1.90106975  0.04769145 -0.36707274  0.49820957 -1.00488442
 [61]  1.24012600  2.54758785  0.50742962 -0.27947589  1.72814567  0.77052722
 [67]  0.30631893 -1.30848686 -1.69576812  0.15675685 -0.18903201 -1.14370044
 [73] -0.09060262  0.71239067 -0.29167817 -0.90380176 -0.77667909  0.44987139
 [79] -0.02941063 -0.13459267 -2.16392607 -0.19832624 -0.95397321  0.78042866
 [85]  0.38960984 -0.33848246  0.54757787 -0.17423553 -0.04054971  0.27433906
 [91] -1.67718964  2.05087455 -0.30708644  1.49652677  0.01671186  1.28421511
 [97] -0.28636036 -0.40142951 -2.14890527 -0.57612738
> colMin(tmp)
  [1]  0.15253631  0.47779878  0.14070865  0.67386855 -0.72187676 -0.21002049
  [7] -0.71348468  0.09487769  1.63381747  0.92319794  0.96459974 -1.21542422
 [13]  0.84544916 -0.82186414 -1.23333252 -1.30235952  0.16167603  0.02762809
 [19] -0.36908522 -0.76845183 -1.02138589  0.80927035 -1.47424451 -1.09488983
 [25]  0.40045650 -1.34536154  0.15849371  1.07146566 -1.65294608  0.66196202
 [31]  0.25376160 -0.71002914 -1.18556829 -0.16969788 -0.90726534  0.06092831
 [37]  1.19562116 -0.02487887  0.77856116  0.26972368  0.47893061 -0.39921738
 [43] -0.73229298 -0.04197176 -0.24139540  0.30048078  0.90835013  0.76966465
 [49] -0.04081873 -0.42262841 -0.67440148  0.42670150 -0.68462905  0.22400733
 [55] -0.20509350 -1.90106975  0.04769145 -0.36707274  0.49820957 -1.00488442
 [61]  1.24012600  2.54758785  0.50742962 -0.27947589  1.72814567  0.77052722
 [67]  0.30631893 -1.30848686 -1.69576812  0.15675685 -0.18903201 -1.14370044
 [73] -0.09060262  0.71239067 -0.29167817 -0.90380176 -0.77667909  0.44987139
 [79] -0.02941063 -0.13459267 -2.16392607 -0.19832624 -0.95397321  0.78042866
 [85]  0.38960984 -0.33848246  0.54757787 -0.17423553 -0.04054971  0.27433906
 [91] -1.67718964  2.05087455 -0.30708644  1.49652677  0.01671186  1.28421511
 [97] -0.28636036 -0.40142951 -2.14890527 -0.57612738
> colMedians(tmp)
  [1]  0.15253631  0.47779878  0.14070865  0.67386855 -0.72187676 -0.21002049
  [7] -0.71348468  0.09487769  1.63381747  0.92319794  0.96459974 -1.21542422
 [13]  0.84544916 -0.82186414 -1.23333252 -1.30235952  0.16167603  0.02762809
 [19] -0.36908522 -0.76845183 -1.02138589  0.80927035 -1.47424451 -1.09488983
 [25]  0.40045650 -1.34536154  0.15849371  1.07146566 -1.65294608  0.66196202
 [31]  0.25376160 -0.71002914 -1.18556829 -0.16969788 -0.90726534  0.06092831
 [37]  1.19562116 -0.02487887  0.77856116  0.26972368  0.47893061 -0.39921738
 [43] -0.73229298 -0.04197176 -0.24139540  0.30048078  0.90835013  0.76966465
 [49] -0.04081873 -0.42262841 -0.67440148  0.42670150 -0.68462905  0.22400733
 [55] -0.20509350 -1.90106975  0.04769145 -0.36707274  0.49820957 -1.00488442
 [61]  1.24012600  2.54758785  0.50742962 -0.27947589  1.72814567  0.77052722
 [67]  0.30631893 -1.30848686 -1.69576812  0.15675685 -0.18903201 -1.14370044
 [73] -0.09060262  0.71239067 -0.29167817 -0.90380176 -0.77667909  0.44987139
 [79] -0.02941063 -0.13459267 -2.16392607 -0.19832624 -0.95397321  0.78042866
 [85]  0.38960984 -0.33848246  0.54757787 -0.17423553 -0.04054971  0.27433906
 [91] -1.67718964  2.05087455 -0.30708644  1.49652677  0.01671186  1.28421511
 [97] -0.28636036 -0.40142951 -2.14890527 -0.57612738
> colRanges(tmp)
          [,1]      [,2]      [,3]      [,4]       [,5]       [,6]       [,7]
[1,] 0.1525363 0.4777988 0.1407086 0.6738685 -0.7218768 -0.2100205 -0.7134847
[2,] 0.1525363 0.4777988 0.1407086 0.6738685 -0.7218768 -0.2100205 -0.7134847
           [,8]     [,9]     [,10]     [,11]     [,12]     [,13]      [,14]
[1,] 0.09487769 1.633817 0.9231979 0.9645997 -1.215424 0.8454492 -0.8218641
[2,] 0.09487769 1.633817 0.9231979 0.9645997 -1.215424 0.8454492 -0.8218641
         [,15]    [,16]    [,17]      [,18]      [,19]      [,20]     [,21]
[1,] -1.233333 -1.30236 0.161676 0.02762809 -0.3690852 -0.7684518 -1.021386
[2,] -1.233333 -1.30236 0.161676 0.02762809 -0.3690852 -0.7684518 -1.021386
         [,22]     [,23]    [,24]     [,25]     [,26]     [,27]    [,28]
[1,] 0.8092703 -1.474245 -1.09489 0.4004565 -1.345362 0.1584937 1.071466
[2,] 0.8092703 -1.474245 -1.09489 0.4004565 -1.345362 0.1584937 1.071466
         [,29]    [,30]     [,31]      [,32]     [,33]      [,34]      [,35]
[1,] -1.652946 0.661962 0.2537616 -0.7100291 -1.185568 -0.1696979 -0.9072653
[2,] -1.652946 0.661962 0.2537616 -0.7100291 -1.185568 -0.1696979 -0.9072653
          [,36]    [,37]       [,38]     [,39]     [,40]     [,41]      [,42]
[1,] 0.06092831 1.195621 -0.02487887 0.7785612 0.2697237 0.4789306 -0.3992174
[2,] 0.06092831 1.195621 -0.02487887 0.7785612 0.2697237 0.4789306 -0.3992174
         [,43]       [,44]      [,45]     [,46]     [,47]     [,48]       [,49]
[1,] -0.732293 -0.04197176 -0.2413954 0.3004808 0.9083501 0.7696647 -0.04081873
[2,] -0.732293 -0.04197176 -0.2413954 0.3004808 0.9083501 0.7696647 -0.04081873
          [,50]      [,51]     [,52]     [,53]     [,54]      [,55]    [,56]
[1,] -0.4226284 -0.6744015 0.4267015 -0.684629 0.2240073 -0.2050935 -1.90107
[2,] -0.4226284 -0.6744015 0.4267015 -0.684629 0.2240073 -0.2050935 -1.90107
          [,57]      [,58]     [,59]     [,60]    [,61]    [,62]     [,63]
[1,] 0.04769145 -0.3670727 0.4982096 -1.004884 1.240126 2.547588 0.5074296
[2,] 0.04769145 -0.3670727 0.4982096 -1.004884 1.240126 2.547588 0.5074296
          [,64]    [,65]     [,66]     [,67]     [,68]     [,69]     [,70]
[1,] -0.2794759 1.728146 0.7705272 0.3063189 -1.308487 -1.695768 0.1567568
[2,] -0.2794759 1.728146 0.7705272 0.3063189 -1.308487 -1.695768 0.1567568
         [,71]   [,72]       [,73]     [,74]      [,75]      [,76]      [,77]
[1,] -0.189032 -1.1437 -0.09060262 0.7123907 -0.2916782 -0.9038018 -0.7766791
[2,] -0.189032 -1.1437 -0.09060262 0.7123907 -0.2916782 -0.9038018 -0.7766791
         [,78]       [,79]      [,80]     [,81]      [,82]      [,83]     [,84]
[1,] 0.4498714 -0.02941063 -0.1345927 -2.163926 -0.1983262 -0.9539732 0.7804287
[2,] 0.4498714 -0.02941063 -0.1345927 -2.163926 -0.1983262 -0.9539732 0.7804287
         [,85]      [,86]     [,87]      [,88]       [,89]     [,90]    [,91]
[1,] 0.3896098 -0.3384825 0.5475779 -0.1742355 -0.04054971 0.2743391 -1.67719
[2,] 0.3896098 -0.3384825 0.5475779 -0.1742355 -0.04054971 0.2743391 -1.67719
        [,92]      [,93]    [,94]      [,95]    [,96]      [,97]      [,98]
[1,] 2.050875 -0.3070864 1.496527 0.01671186 1.284215 -0.2863604 -0.4014295
[2,] 2.050875 -0.3070864 1.496527 0.01671186 1.284215 -0.2863604 -0.4014295
         [,99]     [,100]
[1,] -2.148905 -0.5761274
[2,] -2.148905 -0.5761274
> 
> 
> Max(tmp2)
[1] 2.105237
> Min(tmp2)
[1] -2.119077
> mean(tmp2)
[1] -0.02946026
> Sum(tmp2)
[1] -2.946026
> Var(tmp2)
[1] 0.7207617
> 
> rowMeans(tmp2)
  [1]  0.01285317 -0.71486966 -0.53244244  0.65674339 -0.73874934  0.21553094
  [7] -1.06566771  0.66677356  0.30292212 -0.55350137 -0.10261532 -2.11907695
 [13] -0.59639718 -0.67705906 -0.72477381 -0.87694316 -1.01351435  0.29716845
 [19] -0.28291480 -0.49801340 -0.84917632 -0.37240466  0.28708072  0.55939358
 [25]  0.89784560 -0.93310397 -0.82862121 -0.41148095  0.44714528  0.23117246
 [31]  1.35998792  1.36471378  0.45644963  0.42112260  0.92934840  0.48683635
 [37] -0.34839001  0.51538077 -0.39445080 -0.72378165  0.10961470  0.39346987
 [43] -0.53324134  0.33286745 -1.03433598 -0.31816258 -0.01410101  2.10523718
 [49] -1.07688549  0.36721670  0.10214342  1.59047448 -0.45101965 -1.32315742
 [55]  0.72617172 -0.61405034 -0.37104337  0.58366666 -0.53230863 -0.81542764
 [61]  0.91129169  0.65245582 -0.43939269  0.85910603  1.07953722  1.08576965
 [67] -0.73880980 -0.34819817 -0.70866280 -0.07304477 -1.75427425 -1.10761417
 [73] -0.57648252 -0.26102287  0.51843047  0.46983722  1.49816852 -0.85354995
 [79] -0.43681683  0.48998562 -1.03297047  0.59689089 -1.79849403 -0.76695280
 [85]  1.85422520  0.46210212  0.02058862  0.19878752  1.23376127 -0.24468146
 [91]  0.13668669  0.94177001  0.51448144 -1.60170537  0.38907434 -0.91801356
 [97]  2.06672307  0.57504753  0.73487656 -0.55258589
> rowSums(tmp2)
  [1]  0.01285317 -0.71486966 -0.53244244  0.65674339 -0.73874934  0.21553094
  [7] -1.06566771  0.66677356  0.30292212 -0.55350137 -0.10261532 -2.11907695
 [13] -0.59639718 -0.67705906 -0.72477381 -0.87694316 -1.01351435  0.29716845
 [19] -0.28291480 -0.49801340 -0.84917632 -0.37240466  0.28708072  0.55939358
 [25]  0.89784560 -0.93310397 -0.82862121 -0.41148095  0.44714528  0.23117246
 [31]  1.35998792  1.36471378  0.45644963  0.42112260  0.92934840  0.48683635
 [37] -0.34839001  0.51538077 -0.39445080 -0.72378165  0.10961470  0.39346987
 [43] -0.53324134  0.33286745 -1.03433598 -0.31816258 -0.01410101  2.10523718
 [49] -1.07688549  0.36721670  0.10214342  1.59047448 -0.45101965 -1.32315742
 [55]  0.72617172 -0.61405034 -0.37104337  0.58366666 -0.53230863 -0.81542764
 [61]  0.91129169  0.65245582 -0.43939269  0.85910603  1.07953722  1.08576965
 [67] -0.73880980 -0.34819817 -0.70866280 -0.07304477 -1.75427425 -1.10761417
 [73] -0.57648252 -0.26102287  0.51843047  0.46983722  1.49816852 -0.85354995
 [79] -0.43681683  0.48998562 -1.03297047  0.59689089 -1.79849403 -0.76695280
 [85]  1.85422520  0.46210212  0.02058862  0.19878752  1.23376127 -0.24468146
 [91]  0.13668669  0.94177001  0.51448144 -1.60170537  0.38907434 -0.91801356
 [97]  2.06672307  0.57504753  0.73487656 -0.55258589
> 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.01285317 -0.71486966 -0.53244244  0.65674339 -0.73874934  0.21553094
  [7] -1.06566771  0.66677356  0.30292212 -0.55350137 -0.10261532 -2.11907695
 [13] -0.59639718 -0.67705906 -0.72477381 -0.87694316 -1.01351435  0.29716845
 [19] -0.28291480 -0.49801340 -0.84917632 -0.37240466  0.28708072  0.55939358
 [25]  0.89784560 -0.93310397 -0.82862121 -0.41148095  0.44714528  0.23117246
 [31]  1.35998792  1.36471378  0.45644963  0.42112260  0.92934840  0.48683635
 [37] -0.34839001  0.51538077 -0.39445080 -0.72378165  0.10961470  0.39346987
 [43] -0.53324134  0.33286745 -1.03433598 -0.31816258 -0.01410101  2.10523718
 [49] -1.07688549  0.36721670  0.10214342  1.59047448 -0.45101965 -1.32315742
 [55]  0.72617172 -0.61405034 -0.37104337  0.58366666 -0.53230863 -0.81542764
 [61]  0.91129169  0.65245582 -0.43939269  0.85910603  1.07953722  1.08576965
 [67] -0.73880980 -0.34819817 -0.70866280 -0.07304477 -1.75427425 -1.10761417
 [73] -0.57648252 -0.26102287  0.51843047  0.46983722  1.49816852 -0.85354995
 [79] -0.43681683  0.48998562 -1.03297047  0.59689089 -1.79849403 -0.76695280
 [85]  1.85422520  0.46210212  0.02058862  0.19878752  1.23376127 -0.24468146
 [91]  0.13668669  0.94177001  0.51448144 -1.60170537  0.38907434 -0.91801356
 [97]  2.06672307  0.57504753  0.73487656 -0.55258589
> rowMin(tmp2)
  [1]  0.01285317 -0.71486966 -0.53244244  0.65674339 -0.73874934  0.21553094
  [7] -1.06566771  0.66677356  0.30292212 -0.55350137 -0.10261532 -2.11907695
 [13] -0.59639718 -0.67705906 -0.72477381 -0.87694316 -1.01351435  0.29716845
 [19] -0.28291480 -0.49801340 -0.84917632 -0.37240466  0.28708072  0.55939358
 [25]  0.89784560 -0.93310397 -0.82862121 -0.41148095  0.44714528  0.23117246
 [31]  1.35998792  1.36471378  0.45644963  0.42112260  0.92934840  0.48683635
 [37] -0.34839001  0.51538077 -0.39445080 -0.72378165  0.10961470  0.39346987
 [43] -0.53324134  0.33286745 -1.03433598 -0.31816258 -0.01410101  2.10523718
 [49] -1.07688549  0.36721670  0.10214342  1.59047448 -0.45101965 -1.32315742
 [55]  0.72617172 -0.61405034 -0.37104337  0.58366666 -0.53230863 -0.81542764
 [61]  0.91129169  0.65245582 -0.43939269  0.85910603  1.07953722  1.08576965
 [67] -0.73880980 -0.34819817 -0.70866280 -0.07304477 -1.75427425 -1.10761417
 [73] -0.57648252 -0.26102287  0.51843047  0.46983722  1.49816852 -0.85354995
 [79] -0.43681683  0.48998562 -1.03297047  0.59689089 -1.79849403 -0.76695280
 [85]  1.85422520  0.46210212  0.02058862  0.19878752  1.23376127 -0.24468146
 [91]  0.13668669  0.94177001  0.51448144 -1.60170537  0.38907434 -0.91801356
 [97]  2.06672307  0.57504753  0.73487656 -0.55258589
> 
> colMeans(tmp2)
[1] -0.02946026
> colSums(tmp2)
[1] -2.946026
> colVars(tmp2)
[1] 0.7207617
> colSd(tmp2)
[1] 0.8489768
> colMax(tmp2)
[1] 2.105237
> colMin(tmp2)
[1] -2.119077
> colMedians(tmp2)
[1] -0.04357289
> colRanges(tmp2)
          [,1]
[1,] -2.119077
[2,]  2.105237
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.9703881  1.1703026 -2.5656875  0.8119384 -2.4636999 -4.0868844
 [7]  0.5127596  2.8001599 -1.9501407 -0.7241086
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.46939759
[2,] -0.78651862
[3,] -0.16026386
[4,]  0.07800472
[5,]  1.38941682
> 
> rowApply(tmp,sum)
 [1] -8.2067998 -0.7588831  1.3204161  0.3059886 -2.4345829 -1.2811080
 [7] -0.1875597  2.6260976 -1.1711884  1.3218710
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    7   10    5    2    3    1    9    4     3
 [2,]    2    6    9    3    7    6    7    5   10     5
 [3,]   10    1    1    6    1   10    5   10    3     1
 [4,]    1    9    7    9   10    2    4    8    7     2
 [5,]    6    2    2   10    6    4    9    4    1     9
 [6,]    4    8    5    1    5    7    3    3    2     8
 [7,]    5    3    3    2    8    9    8    1    8    10
 [8,]    8   10    8    8    3    1   10    7    9     6
 [9,]    7    5    6    4    4    8    2    2    5     7
[10,]    3    4    4    7    9    5    6    6    6     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.6213213  0.9554185 -0.3282998  1.2468067 -0.4292214 -0.5748513
 [7]  2.5550250  5.5100251 -2.1405315  2.0535898 -1.1698499 -2.0383819
[13] -2.4079042 -0.9983038  3.3037249  2.1463537  0.9929844 -2.4110286
[19] -0.1094018 -1.2943571
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.5815486
[2,] -0.4264026
[3,] -0.1634005
[4,]  0.5845351
[5,]  1.2081380
> 
> rowApply(tmp,sum)
[1]  0.2662017  0.7113208  1.8397860  5.4097180 -2.7439083
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   15   18    4    8    9
[2,]    4   15    7   19   11
[3,]   19    9    2   15    6
[4,]   17    4   17    7   13
[5,]   18   14   10    3    3
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  0.5845351 -0.9746448  1.3761987  0.9752652  1.02550644  1.5062975
[2,]  1.2081380  0.4990775  0.1431312 -1.0733233  0.41295540 -1.8201212
[3,] -0.5815486 -0.3622531 -1.6486273  1.1501508  0.03969431  0.3104042
[4,] -0.1634005  1.9866967  0.7692509 -0.2309327 -0.67905957 -0.1072493
[5,] -0.4264026 -0.1934579 -0.9682533  0.4256466 -1.22831798 -0.4641824
           [,7]      [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -1.0580549 0.3705849 -0.3658528  0.1888554 -0.6319686  0.6459226
[2,]  0.8732956 0.7510460  0.1915413 -0.0208142 -1.6208059 -1.4120251
[3,]  0.2666674 2.1186518  0.8675635 -0.2131103 -0.4210324 -2.3728806
[4,]  0.0258187 1.6629449 -0.5377976  1.1024682  0.1183947  2.1176464
[5,]  2.4472982 0.6067975 -2.2959859  0.9961908  1.3855623 -1.0170453
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -1.5673720  0.2718406 -0.4795503  0.3318278 -0.2470253 -1.0381955
[2,]  0.2795882  0.4085761  2.3996978  0.4012386 -0.5406737 -0.6783763
[3,]  0.3168731 -0.5227240  0.5416317  0.8062585  1.4048598  1.3043339
[4,] -0.5052897  0.6322944  0.3578934  1.7693223 -0.5309426 -1.6213834
[5,] -0.9317039 -1.7882909  0.4840523 -1.1622935  0.9067663 -0.3774073
          [,19]      [,20]
[1,] -0.2842337 -0.3637347
[2,] -0.9235739  1.2327487
[3,] -0.0713320 -1.0937946
[4,]  0.4391885 -1.1961459
[5,]  0.7305493  0.1265694
> 
> 
> 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.14-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.14-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.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  593  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2        col3       col4     col5       col6     col7
row1 0.6834642 0.2699663 -0.05651096 0.02755195 0.816295 -0.9514466 0.456649
         col8     col9       col10      col11     col12     col13     col14
row1 0.792234 1.232043 -0.09505748 -0.7103421 0.8014754 0.5528075 0.3724735
          col15     col16     col17      col18     col19      col20
row1 -0.3543705 0.3011108 0.6879835 0.07896118 0.1814027 0.07288296
> tmp[,"col10"]
           col10
row1 -0.09505748
row2  1.81344414
row3 -0.95819335
row4  2.40797704
row5 -0.61948657
> tmp[c("row1","row5"),]
          col1      col2        col3        col4      col5       col6
row1 0.6834642 0.2699663 -0.05651096  0.02755195 0.8162950 -0.9514466
row5 0.4193274 0.1332992 -0.23663767 -0.93125775 0.6737271  1.9943374
           col7      col8       col9       col10      col11      col12
row1  0.4566490  0.792234 1.23204285 -0.09505748 -0.7103421  0.8014754
row5 -0.2366407 -0.460164 0.09886159 -0.61948657  1.2977439 -0.6565663
         col13     col14      col15      col16      col17       col18     col19
row1 0.5528075 0.3724735 -0.3543705  0.3011108  0.6879835  0.07896118 0.1814027
row5 0.2139509 0.9172501 -0.4595917 -1.4214851 -0.8115187 -0.80824680 1.5812762
          col20
row1 0.07288296
row5 0.35143620
> tmp[,c("col6","col20")]
            col6       col20
row1 -0.95144663  0.07288296
row2 -1.46606369  1.27603069
row3 -0.09853441 -0.47119421
row4 -1.58525892  0.01074742
row5  1.99433739  0.35143620
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.9514466 0.07288296
row5  1.9943374 0.35143620
> 
> 
> 
> 
> 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.20318 49.69752 49.84489 51.52096 49.65298 105.4084 52.46588 50.27241
         col9    col10    col11    col12   col13    col14    col15    col16
row1 49.34471 51.14444 48.68332 49.39858 51.0093 51.91279 51.44406 48.57563
        col17    col18    col19    col20
row1 50.69553 50.91536 50.85914 103.5277
> tmp[,"col10"]
        col10
row1 51.14444
row2 30.85008
row3 28.13915
row4 28.86967
row5 50.24111
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.20318 49.69752 49.84489 51.52096 49.65298 105.4084 52.46588 50.27241
row5 47.96475 51.86385 50.40238 47.93130 48.78875 105.1142 51.89627 49.48316
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.34471 51.14444 48.68332 49.39858 51.00930 51.91279 51.44406 48.57563
row5 50.11159 50.24111 50.02511 49.49229 47.70687 52.02685 50.41070 48.54633
        col17    col18    col19    col20
row1 50.69553 50.91536 50.85914 103.5277
row5 51.34344 48.80678 51.48824 107.2864
> tmp[,c("col6","col20")]
          col6     col20
row1 105.40843 103.52766
row2  76.03446  74.16913
row3  74.63559  77.38821
row4  74.12139  76.54268
row5 105.11415 107.28640
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.4084 103.5277
row5 105.1142 107.2864
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.4084 103.5277
row5 105.1142 107.2864
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.6971433
[2,]  0.1809733
[3,]  2.4512493
[4,] -0.8218306
[5,]  2.0653985
> tmp[,c("col17","col7")]
           col17        col7
[1,] -0.08390798  0.40764764
[2,] -1.43317121  0.08043374
[3,] -1.18117329 -0.36336980
[4,] -0.38898060  0.89769471
[5,]  0.05867876  1.53682165
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6        col20
[1,] -0.06240417 -2.956082283
[2,] -0.31357230  0.575671681
[3,] -0.17975190 -0.004150479
[4,] -0.83858389 -0.281807994
[5,]  1.20480988  0.359522124
> subBufferedMatrix(tmp,1,c("col6"))[,1]
            col1
[1,] -0.06240417
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.06240417
[2,] -0.31357230
> 
> 
> 
> 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.025876 -0.2431744 0.7507149  1.0425799  0.8052638 -2.9929906 0.9811625
row1 -1.004137 -1.1004008 0.3905415 -0.4296408 -0.1150486 -0.1282872 0.5646436
            [,8]       [,9]      [,10]      [,11]      [,12]       [,13]
row3 -1.48927939 -0.0914347  0.5090662  0.3089909 -0.7245839  0.66605153
row1 -0.09823754 -1.4276205 -0.1998754 -0.3771572 -0.8976524 -0.09813716
          [,14]      [,15]     [,16]      [,17]      [,18]      [,19]
row3 -0.8484694 -0.4886481 2.1140098 -0.3349045 -0.3413620 -0.5633160
row1  0.7148685  0.1297018 0.8027799  0.9372428  0.7812414  0.8539082
          [,20]
row3  0.5247465
row1 -0.4746407
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]      [,3]     [,4]      [,5]      [,6]     [,7]
row2 0.01491713 -0.1315752 -2.282324 1.544149 -1.072819 0.5347452 2.291346
           [,8]       [,9]     [,10]
row2 -0.5870316 -0.3161327 0.3586145
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]     [,3]      [,4]     [,5]      [,6]      [,7]
row5 0.2588275 1.085278 -2.57624 -1.102431 1.416061 -1.057942 0.8333793
         [,8]     [,9]     [,10]     [,11]     [,12]    [,13]     [,14]
row5 1.077488 1.558473 -1.023951 0.3629414 -1.046799 0.455498 0.2197039
         [,15]    [,16]      [,17]     [,18]     [,19]      [,20]
row5 0.2099885 1.028739 -0.5521674 -1.944589 -1.269444 -0.6181468
> 
> 
> 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: 0x00000000050b2c48>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c86d581471"
 [2] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c86c3932e1"
 [3] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c81a0a7247"
 [4] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c83201446a"
 [5] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c8abb6e08" 
 [6] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c81f0364c1"
 [7] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c84a074d2e"
 [8] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c839e622de"
 [9] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c874002110"
[10] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c8606c7a5d"
[11] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c83e801ebd"
[12] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c8325ca7f" 
[13] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c85bbe2e2b"
[14] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c828bf3e72"
[15] "C:/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM16c86b207491"
> 
> 
> ### 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: 0x0000000004d4af50>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0000000004d4af50>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.14-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0000000004d4af50>
> rowMedians(tmp)
  [1]  0.2299710208 -0.5069151521  0.3199106846  0.4639884689 -0.4184125432
  [6] -0.8249899964  0.0270137793  0.1905763646  0.0942355118 -0.1821131133
 [11] -0.1570728269  0.0231905755 -0.2827767547 -0.0595187996 -0.1591176893
 [16]  0.1270650825 -0.5349303638  0.1807468147  0.6135386787  0.2582583337
 [21] -0.1072405919 -0.3430820451 -0.2391859778  0.3901353951 -0.1910186179
 [26]  0.2916993987  0.2471848956  0.6977616486 -0.6796208401 -0.0556655434
 [31] -0.4661824615  0.3198350436  0.3436974133 -0.5981549174  0.3912016156
 [36]  0.0026397811  0.4703793587  0.1233083304  0.3530422301  0.1811412470
 [41]  0.3252932918  0.3572783760  0.1411197645  0.2584504876  0.2320922406
 [46]  0.5683779952  0.5132994767  0.4075401180 -0.1378961021  0.1606356529
 [51]  0.4229368522 -0.3982031522 -0.2307621988  0.2939086065  0.3332634606
 [56] -0.1044333868  0.1397937861 -0.1806619171  0.0426321695  0.0475432063
 [61]  0.3865108355 -0.0768159008  0.4529110426 -0.1719795829  0.3939572391
 [66]  0.2526150820  0.3843282856 -0.0003572948  0.2140189704 -0.0094990539
 [71] -0.3195943863  0.0228441149  0.2706061322  0.2129860712 -0.0773668986
 [76]  0.4816901129 -0.0102526542 -0.2582885535  0.3453667347  0.4385134637
 [81]  0.0583102527 -0.0077835199  0.1986372408 -0.0929970057 -0.2455331536
 [86] -0.1703410558  0.1193525296  0.5011258935 -0.4807686806  0.6845714733
 [91] -0.2243235708  0.1788021185  0.2350515334 -0.1030906979 -0.9218851477
 [96] -0.6349979356  0.0367410487 -0.0603571412 -0.4969046643 -0.1075200570
[101] -0.2528871955  0.0487849699 -0.2336077078 -0.2757428481  0.4382621554
[106] -0.5626751791  0.1628386646  0.1103580811 -0.2560958121 -0.2806193927
[111] -0.0319836978  0.2070929242 -0.1930897851  0.1232235803 -0.1085470083
[116]  0.3258697608  0.2259360216 -0.1783952985 -0.3033991018  0.6002546984
[121]  0.0139232762 -0.2615573300 -0.0775057816  0.1760684378  0.1762691426
[126]  0.7123082673  0.4997175775  0.2164198786  0.3195715992 -0.0579919211
[131] -0.1439902753  0.0741650152  0.1286194173 -0.3925260970 -0.1390142130
[136]  0.1820963103 -0.5482746968  0.0460317539 -0.3424193546  0.2575280155
[141] -0.5214150219  0.0985732985 -0.0265498998 -0.1730734105  0.4561691013
[146]  0.2152530175  0.2553191790  0.3842242719  0.2851234931 -0.1855807930
[151]  0.1389223983  0.1735011598 -0.1398925603 -0.2533116398 -0.0631671300
[156]  0.2260817857 -0.3557780601  0.0866012988  0.1640494852 -0.2528259114
[161] -0.2163116637 -0.2499767664 -0.3523696822  0.3028103565 -0.5632539062
[166]  0.1203940206  0.2521948895  0.1175944245  0.0994128049 -0.4684181466
[171] -0.2630871337  0.6489204515 -0.2210521880  0.2715702348  0.0877961100
[176]  0.0478868522  0.2545545119  0.5936045680 -0.5415097561 -0.0641607191
[181]  0.5631204431  0.2701403079  0.1484026187 -0.1353480693  0.3407899270
[186]  0.2472799910 -0.1002829521 -0.4969200435 -0.6238742836  0.4590296542
[191] -0.3777856913 -0.0271012390 -0.2341384002  0.3645462513  0.0064473196
[196]  0.2952476631  0.7286410732  0.2337536170 -0.4924815213 -0.1684067623
[201] -0.3083113549 -0.7664622212 -0.1239279593  0.2913123295  0.0328480967
[206]  0.0029451886 -0.0903859041  0.2633755113 -0.3516127917 -0.8167214181
[211]  0.3066510213 -0.0096168036 -0.2125314525 -0.5433976963 -0.0821695931
[216] -0.1999206763  0.0307470129  0.6067477935  0.1788953595  0.6237128361
[221] -0.0145099507 -0.1322090551  0.5613746915 -0.3245750995  0.0913045707
[226] -0.1286001775 -0.1812064399  0.0807537789 -0.2713331044  0.4589044823
> 
> proc.time()
   user  system elapsed 
   3.26    9.07   13.35 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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: 0x028d95b0>
> .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: 0x028d95b0>
> .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: 0x028d95b0>
> .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: 0x028d95b0>
> 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: 0x01f59048>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01f59048>
> .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: 0x01f59048>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01f59048>
> .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: 0x01f59048>
> 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: 0x0218c6f8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0218c6f8>
> .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: 0x0218c6f8>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0218c6f8>
> .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: 0x0218c6f8>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0218c6f8>
> .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: 0x0218c6f8>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0218c6f8>
> .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: 0x0218c6f8>
> 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: 0x035aad40>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x035aad40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x035aad40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x035aad40>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile28dc1b8533d4" "BufferedMatrixFile28dc51b3d21" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile28dc1b8533d4" "BufferedMatrixFile28dc51b3d21" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x01ecc118>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01ecc118>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01ecc118>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01ecc118>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x01ecc118>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x01ecc118>
> .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: 0x03906dd8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03906dd8>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x03906dd8>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x03906dd8>
> 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: 0x03a7f400>
> .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: 0x03a7f400>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.59    0.07    0.65 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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: 0x0000000004ea21f8>
> .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: 0x0000000004ea21f8>
> .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: 0x0000000004ea21f8>
> .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: 0x0000000004ea21f8>
> 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: 0x00000000062f3ce0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000062f3ce0>
> .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: 0x00000000062f3ce0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000062f3ce0>
> .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: 0x00000000062f3ce0>
> 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: 0x0000000007ae39a8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007ae39a8>
> .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: 0x0000000007ae39a8>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000007ae39a8>
> .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: 0x0000000007ae39a8>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000007ae39a8>
> .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: 0x0000000007ae39a8>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000007ae39a8>
> .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: 0x0000000007ae39a8>
> 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: 0x00000000063db198>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x00000000063db198>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000063db198>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000063db198>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2098172a4bd8" "BufferedMatrixFile20987cc519eb"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2098172a4bd8" "BufferedMatrixFile20987cc519eb"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000004e189b8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000004e189b8>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000004e189b8>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000004e189b8>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000004e189b8>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000004e189b8>
> .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: 0x00000000074732d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000074732d0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000074732d0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x00000000074732d0>
> 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: 0x00000000066f80f8>
> .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: 0x00000000066f80f8>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.53    0.09    0.61 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.51    0.04    0.54 

Example timings