Back to Multiple platform build/check report for BioC 3.20:   simplified   long
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2025-01-09 12:05 -0500 (Thu, 09 Jan 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.1 LTS)x86_644.4.2 (2024-10-31) -- "Pile of Leaves" 4744
palomino8Windows Server 2022 Datacenterx644.4.2 (2024-10-31 ucrt) -- "Pile of Leaves" 4487
merida1macOS 12.7.5 Montereyx86_644.4.2 (2024-10-31) -- "Pile of Leaves" 4515
kjohnson1macOS 13.6.6 Venturaarm644.4.2 (2024-10-31) -- "Pile of Leaves" 4467
taishanLinux (openEuler 24.03 LTS)aarch644.4.2 (2024-10-31) -- "Pile of Leaves" 4358
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

Package 251/2289HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.70.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-01-02 13:00 -0500 (Thu, 02 Jan 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_20
git_last_commit: 32b6f6a
git_last_commit_date: 2024-10-29 09:27:20 -0500 (Tue, 29 Oct 2024)
nebbiolo2Linux (Ubuntu 24.04.1 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino8Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 12.7.5 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson1macOS 13.6.6 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
taishanLinux (openEuler 24.03 LTS) / aarch64  OK    OK    OK  


CHECK results for BufferedMatrix on palomino8

To the developers/maintainers of the BufferedMatrix package:
- 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 Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.70.0
Command: F:\biocbuild\bbs-3.20-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:BufferedMatrix.install-out.txt --library=F:\biocbuild\bbs-3.20-bioc\R\library --no-vignettes --timings BufferedMatrix_1.70.0.tar.gz
StartedAt: 2025-01-02 23:38:53 -0500 (Thu, 02 Jan 2025)
EndedAt: 2025-01-02 23:44:56 -0500 (Thu, 02 Jan 2025)
EllapsedTime: 362.7 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   F:\biocbuild\bbs-3.20-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:BufferedMatrix.install-out.txt --library=F:\biocbuild\bbs-3.20-bioc\R\library --no-vignettes --timings BufferedMatrix_1.70.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.4.2 (2024-10-31 ucrt)
* using platform: x86_64-w64-mingw32
* R was compiled by
    gcc.exe (GCC) 13.3.0
    GNU Fortran (GCC) 13.3.0
* running under: Windows Server 2022 x64 (build 20348)
* using session charset: UTF-8
* using option '--no-vignettes'
* checking for file 'BufferedMatrix/DESCRIPTION' ... OK
* this is package 'BufferedMatrix' version '1.70.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
* used C compiler: 'gcc.exe (GCC) 13.3.0'
* 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 code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* 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
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
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 x64 is not available
File 'F:/biocbuild/bbs-3.20-bioc/R/library/BufferedMatrix/libs/x64/BufferedMatrix.dll':
  Found '_exit', possibly from '_exit' (C)
  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 nor [v]sprintf. 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 sizes of PDF files under 'inst/doc' ... OK
* checking files in 'vignettes' ... OK
* checking examples ... NONE
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
  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 ... 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
  'F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   F:\biocbuild\bbs-3.20-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library 'F:/biocbuild/bbs-3.20-bioc/R/library'
* installing *source* package 'BufferedMatrix' ...
** using staged installation
** libs
using C compiler: 'gcc.exe (GCC) 13.3.0'
gcc  -I"F:/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG     -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc  -I"F:/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG     -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -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]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: 'sort_double' defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc  -I"F:/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG     -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc  -I"F:/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG     -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c init_package.c -o init_package.o
gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/rtools44/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools44/x86_64-w64-mingw32.static.posix/lib -LF:/biocbuild/bbs-3.20-bioc/R/bin/x64 -lR
installing to F:/biocbuild/bbs-3.20-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs/x64
** 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
** 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
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.4.2 (2024-10-31 ucrt) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
   0.40    0.07    2.81 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.2 (2024-10-31 ucrt) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

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] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests"
> 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 468478 25.1    1021802 54.6   633411 33.9
Vcells 853910  6.6    8388608 64.0  2003128 15.3
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Jan  2 23:39:39 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Jan  2 23:39:45 2025"
> 
> 
> 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: 0x000001a6950fa890>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Jan  2 23:41:03 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Jan  2 23:41:25 2025"
> 
> ColMode(tmp2)
<pointer: 0x000001a6950fa890>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
             [,1]       [,2]        [,3]       [,4]
[1,] 100.63697640  0.4060968 -0.01958948 -0.8801770
[2,]   0.39761621 -1.0217144 -0.13043905  1.3854965
[3,]  -0.03795614  1.0698066  0.29266603 -0.5361793
[4,]  -0.96614291 -0.6675656 -0.47742083 -1.3950338
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]      [,2]       [,3]      [,4]
[1,] 100.63697640 0.4060968 0.01958948 0.8801770
[2,]   0.39761621 1.0217144 0.13043905 1.3854965
[3,]   0.03795614 1.0698066 0.29266603 0.5361793
[4,]   0.96614291 0.6675656 0.47742083 1.3950338
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0317983 0.6372572 0.1399624 0.9381775
[2,]  0.6305682 1.0107989 0.3611635 1.1770711
[3,]  0.1948234 1.0343145 0.5409862 0.7322426
[4,]  0.9829257 0.8170469 0.6909565 1.1811155
> 
> 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:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.95496 31.77867 26.41921 35.26195
[2,]  31.70330 36.12970 28.74207 38.15621
[3,]  26.98619 36.41295 30.70253 32.85861
[4,]  35.79540 33.83803 32.38699 38.20619
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x000001a6950fa530>
> exp(tmp5)
<pointer: 0x000001a6950fa530>
> log(tmp5,2)
<pointer: 0x000001a6950fa530>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.2956
> Min(tmp5)
[1] 53.73005
> mean(tmp5)
[1] 72.94842
> Sum(tmp5)
[1] 14589.68
> Var(tmp5)
[1] 872.0504
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.38613 70.27019 67.43689 73.51831 70.15526 68.52469 73.29912 70.59562
 [9] 71.92441 72.37362
> rowSums(tmp5)
 [1] 1827.723 1405.404 1348.738 1470.366 1403.105 1370.494 1465.982 1411.912
 [9] 1438.488 1447.472
> rowVars(tmp5)
 [1] 8049.74409   75.48520   97.96135   94.50228   62.73880   83.59153
 [7]   81.24333   64.69312   42.65462   47.03766
> rowSd(tmp5)
 [1] 89.720366  8.688222  9.897543  9.721228  7.920783  9.142840  9.013508
 [8]  8.043203  6.531050  6.858401
> rowMax(tmp5)
 [1] 470.29564  84.08675  95.26696  89.71407  92.35135  83.73548  89.48767
 [8]  82.16089  85.70353  84.50565
> rowMin(tmp5)
 [1] 54.98813 58.01213 55.10556 54.86796 59.41856 53.73005 57.85517 55.49511
 [9] 58.29583 61.76797
> 
> colMeans(tmp5)
 [1] 108.32110  72.40172  66.37090  71.17687  72.81160  69.92916  70.67461
 [8]  72.32872  73.03977  70.60832  73.27365  69.37099  71.62681  72.41978
[15]  66.51349  70.67374  76.92302  69.26387  71.40145  69.83893
> colSums(tmp5)
 [1] 1083.2110  724.0172  663.7090  711.7687  728.1160  699.2916  706.7461
 [8]  723.2872  730.3977  706.0832  732.7365  693.7099  716.2681  724.1978
[15]  665.1349  706.7374  769.2302  692.6387  714.0145  698.3893
> colVars(tmp5)
 [1] 16245.50091    53.48162    37.00670    77.63434   153.00701    51.23584
 [7]    88.25907    43.26509    96.81066    73.87117   123.23200    67.78652
[13]    51.26246   154.49403    48.81285    56.67169    43.69404    79.51285
[19]    57.16180   100.36064
> colSd(tmp5)
 [1] 127.457840   7.313113   6.083313   8.811035  12.369600   7.157921
 [7]   9.394630   6.577620   9.839241   8.594834  11.100991   8.233257
[13]   7.159781  12.429563   6.986619   7.528060   6.610147   8.916998
[19]   7.560542  10.018016
> colMax(tmp5)
 [1] 470.29564  85.70353  74.55373  82.17525  89.71407  78.42334  88.92153
 [8]  82.16089  89.48767  84.55635  92.35135  81.17884  79.79558  95.26696
[15]  79.00112  84.02184  84.24209  88.73897  85.67131  86.78365
> colMin(tmp5)
 [1] 56.16822 64.01676 54.98813 56.99792 53.73005 54.86796 55.10556 62.43926
 [9] 59.38679 57.85517 60.90935 57.13114 58.01213 58.29583 55.49511 60.26923
[17] 66.02789 58.40903 59.58223 56.82168
> 
> 
> ### 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] 91.38613 70.27019 67.43689       NA 70.15526 68.52469 73.29912 70.59562
 [9] 71.92441 72.37362
> rowSums(tmp5)
 [1] 1827.723 1405.404 1348.738       NA 1403.105 1370.494 1465.982 1411.912
 [9] 1438.488 1447.472
> rowVars(tmp5)
 [1] 8049.74409   75.48520   97.96135   96.92773   62.73880   83.59153
 [7]   81.24333   64.69312   42.65462   47.03766
> rowSd(tmp5)
 [1] 89.720366  8.688222  9.897543  9.845188  7.920783  9.142840  9.013508
 [8]  8.043203  6.531050  6.858401
> rowMax(tmp5)
 [1] 470.29564  84.08675  95.26696        NA  92.35135  83.73548  89.48767
 [8]  82.16089  85.70353  84.50565
> rowMin(tmp5)
 [1] 54.98813 58.01213 55.10556       NA 59.41856 53.73005 57.85517 55.49511
 [9] 58.29583 61.76797
> 
> colMeans(tmp5)
 [1] 108.32110  72.40172  66.37090  71.17687  72.81160  69.92916  70.67461
 [8]  72.32872  73.03977  70.60832  73.27365  69.37099  71.62681  72.41978
[15]  66.51349  70.67374  76.92302  69.26387        NA  69.83893
> colSums(tmp5)
 [1] 1083.2110  724.0172  663.7090  711.7687  728.1160  699.2916  706.7461
 [8]  723.2872  730.3977  706.0832  732.7365  693.7099  716.2681  724.1978
[15]  665.1349  706.7374  769.2302  692.6387        NA  698.3893
> colVars(tmp5)
 [1] 16245.50091    53.48162    37.00670    77.63434   153.00701    51.23584
 [7]    88.25907    43.26509    96.81066    73.87117   123.23200    67.78652
[13]    51.26246   154.49403    48.81285    56.67169    43.69404    79.51285
[19]          NA   100.36064
> colSd(tmp5)
 [1] 127.457840   7.313113   6.083313   8.811035  12.369600   7.157921
 [7]   9.394630   6.577620   9.839241   8.594834  11.100991   8.233257
[13]   7.159781  12.429563   6.986619   7.528060   6.610147   8.916998
[19]         NA  10.018016
> colMax(tmp5)
 [1] 470.29564  85.70353  74.55373  82.17525  89.71407  78.42334  88.92153
 [8]  82.16089  89.48767  84.55635  92.35135  81.17884  79.79558  95.26696
[15]  79.00112  84.02184  84.24209  88.73897        NA  86.78365
> colMin(tmp5)
 [1] 56.16822 64.01676 54.98813 56.99792 53.73005 54.86796 55.10556 62.43926
 [9] 59.38679 57.85517 60.90935 57.13114 58.01213 58.29583 55.49511 60.26923
[17] 66.02789 58.40903       NA 56.82168
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.2956
> Min(tmp5,na.rm=TRUE)
[1] 53.73005
> mean(tmp5,na.rm=TRUE)
[1] 72.98048
> Sum(tmp5,na.rm=TRUE)
[1] 14523.12
> Var(tmp5,na.rm=TRUE)
[1] 876.2481
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.38613 70.27019 67.43689 73.88410 70.15526 68.52469 73.29912 70.59562
 [9] 71.92441 72.37362
> rowSums(tmp5,na.rm=TRUE)
 [1] 1827.723 1405.404 1348.738 1403.798 1403.105 1370.494 1465.982 1411.912
 [9] 1438.488 1447.472
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.74409   75.48520   97.96135   96.92773   62.73880   83.59153
 [7]   81.24333   64.69312   42.65462   47.03766
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.720366  8.688222  9.897543  9.845188  7.920783  9.142840  9.013508
 [8]  8.043203  6.531050  6.858401
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.29564  84.08675  95.26696  89.71407  92.35135  83.73548  89.48767
 [8]  82.16089  85.70353  84.50565
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.98813 58.01213 55.10556 54.86796 59.41856 53.73005 57.85517 55.49511
 [9] 58.29583 61.76797
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.32110  72.40172  66.37090  71.17687  72.81160  69.92916  70.67461
 [8]  72.32872  73.03977  70.60832  73.27365  69.37099  71.62681  72.41978
[15]  66.51349  70.67374  76.92302  69.26387  71.93846  69.83893
> colSums(tmp5,na.rm=TRUE)
 [1] 1083.2110  724.0172  663.7090  711.7687  728.1160  699.2916  706.7461
 [8]  723.2872  730.3977  706.0832  732.7365  693.7099  716.2681  724.1978
[15]  665.1349  706.7374  769.2302  692.6387  647.4462  698.3893
> colVars(tmp5,na.rm=TRUE)
 [1] 16245.50091    53.48162    37.00670    77.63434   153.00701    51.23584
 [7]    88.25907    43.26509    96.81066    73.87117   123.23200    67.78652
[13]    51.26246   154.49403    48.81285    56.67169    43.69404    79.51285
[19]    61.06273   100.36064
> colSd(tmp5,na.rm=TRUE)
 [1] 127.457840   7.313113   6.083313   8.811035  12.369600   7.157921
 [7]   9.394630   6.577620   9.839241   8.594834  11.100991   8.233257
[13]   7.159781  12.429563   6.986619   7.528060   6.610147   8.916998
[19]   7.814265  10.018016
> colMax(tmp5,na.rm=TRUE)
 [1] 470.29564  85.70353  74.55373  82.17525  89.71407  78.42334  88.92153
 [8]  82.16089  89.48767  84.55635  92.35135  81.17884  79.79558  95.26696
[15]  79.00112  84.02184  84.24209  88.73897  85.67131  86.78365
> colMin(tmp5,na.rm=TRUE)
 [1] 56.16822 64.01676 54.98813 56.99792 53.73005 54.86796 55.10556 62.43926
 [9] 59.38679 57.85517 60.90935 57.13114 58.01213 58.29583 55.49511 60.26923
[17] 66.02789 58.40903 59.58223 56.82168
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.38613 70.27019 67.43689      NaN 70.15526 68.52469 73.29912 70.59562
 [9] 71.92441 72.37362
> rowSums(tmp5,na.rm=TRUE)
 [1] 1827.723 1405.404 1348.738    0.000 1403.105 1370.494 1465.982 1411.912
 [9] 1438.488 1447.472
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.74409   75.48520   97.96135         NA   62.73880   83.59153
 [7]   81.24333   64.69312   42.65462   47.03766
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.720366  8.688222  9.897543        NA  7.920783  9.142840  9.013508
 [8]  8.043203  6.531050  6.858401
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.29564  84.08675  95.26696        NA  92.35135  83.73548  89.48767
 [8]  82.16089  85.70353  84.50565
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.98813 58.01213 55.10556       NA 59.41856 53.73005 57.85517 55.49511
 [9] 58.29583 61.76797
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.07861  72.62086  66.25552  70.24972  70.93355  71.60262  68.64718
 [8]  73.42755  73.84391  71.65012  72.84712  68.85277  71.54298  71.76780
[15]  65.12597  69.19062  78.13359  67.09997       NaN  69.89315
> colSums(tmp5,na.rm=TRUE)
 [1] 1008.7075  653.5878  596.2997  632.2475  638.4019  644.4236  617.8246
 [8]  660.8480  664.5952  644.8511  655.6241  619.6749  643.8868  645.9102
[15]  586.1337  622.7156  703.2023  603.8997    0.0000  629.0383
> colVars(tmp5,na.rm=TRUE)
 [1] 18117.35045    59.62656    41.48279    77.66816   132.45325    26.13483
 [7]    53.04839    35.08967   101.63729    70.89496   136.58935    73.23862
[13]    57.59119   169.02374    33.25598    39.00959    32.66915    36.77425
[19]          NA   112.87266
> colSd(tmp5,na.rm=TRUE)
 [1] 134.600707   7.721824   6.440713   8.812954  11.508833   5.112223
 [7]   7.283433   5.923654  10.081532   8.419915  11.687145   8.557956
[13]   7.588886  13.000913   5.766800   6.245766   5.715694   6.064177
[19]         NA  10.624154
> colMax(tmp5,na.rm=TRUE)
 [1] 470.29564  85.70353  74.55373  82.17525  86.63355  78.42334  76.73124
 [8]  82.16089  89.48767  84.55635  92.35135  81.17884  79.79558  95.26696
[15]  75.97718  79.00804  84.24209  78.79872      -Inf  86.78365
> colMin(tmp5,na.rm=TRUE)
 [1] 56.16822 64.01676 54.98813 56.99792 53.73005 61.61163 55.10556 65.68347
 [9] 59.38679 57.85517 60.90935 57.13114 58.01213 58.29583 55.49511 60.26923
[17] 69.10452 58.40903      Inf 56.82168
> 
> 
> 
> 
> 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] 132.8914 193.3169 396.0614 243.9357 256.5203 194.5097 193.4299 219.9724
 [9] 146.8604 134.6546
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 132.8914 193.3169 396.0614 243.9357 256.5203 194.5097 193.4299 219.9724
 [9] 146.8604 134.6546
> 
> 
> 
> 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]  0.000000e+00 -2.842171e-14 -2.842171e-14  5.684342e-14 -5.684342e-14
 [6] -2.842171e-14 -5.684342e-14  5.684342e-14  1.136868e-13  1.136868e-13
[11] -5.684342e-14  0.000000e+00  5.684342e-14 -8.526513e-14 -8.526513e-14
[16] -8.526513e-14 -2.842171e-14  1.705303e-13 -2.842171e-14 -2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   12 
4   19 
6   17 
4   1 
9   16 
9   2 
10   17 
7   5 
7   20 
8   10 
2   19 
8   15 
9   9 
1   14 
10   16 
4   9 
2   20 
2   3 
8   11 
1   15 
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.74193
> Min(tmp)
[1] -1.638504
> mean(tmp)
[1] 0.09807583
> Sum(tmp)
[1] 9.807583
> Var(tmp)
[1] 0.7959642
> 
> rowMeans(tmp)
[1] 0.09807583
> rowSums(tmp)
[1] 9.807583
> rowVars(tmp)
[1] 0.7959642
> rowSd(tmp)
[1] 0.8921683
> rowMax(tmp)
[1] 2.74193
> rowMin(tmp)
[1] -1.638504
> 
> colMeans(tmp)
  [1]  0.266780302 -1.385240463 -0.328497198 -0.358193454 -1.638503896
  [6] -0.518308188 -0.533664923 -0.661992596 -0.744826698  0.275301641
 [11] -0.984526552 -0.782650887  0.189105856 -0.488662590 -0.679058543
 [16]  0.197296758  0.315984738  0.604549352  0.053514007  0.988255124
 [21]  0.235879034 -0.046589037 -1.349360638  0.041229598  1.445216264
 [26] -0.384355484  1.799066595  0.607552629  0.810098102  0.120225542
 [31] -0.038144064 -0.107184960 -1.488030194 -0.063037205  0.207380455
 [36] -0.987542061 -0.288692341 -1.049847244  1.333258241  0.821974433
 [41]  0.147120025  0.552374329 -1.150882491  0.934643795  1.939455171
 [46] -0.633795649  0.538702291 -0.180331578 -0.842417822 -0.212718680
 [51] -0.751908613 -0.022704523  0.403193388  0.105986713  0.929471576
 [56]  0.297806837  1.610493642  0.828213230  2.741930083 -0.879962545
 [61] -0.376166034  1.448374115  1.006186368 -0.734869445 -0.348115586
 [66] -0.238395668 -1.308816137  2.640982766  0.626998468  0.700022763
 [71] -0.211936579 -0.438391489 -0.062517795  1.150487984 -0.781679195
 [76]  0.947090456  0.454414276  0.787889987 -0.033541555  0.092435260
 [81] -0.003415863  1.995851979  0.049249360  0.616403766  0.676339123
 [86] -0.614150834 -0.762148889  0.612176965  1.216256137  0.285323566
 [91] -0.225802983 -0.358259204  0.580246727  1.294273327 -1.306836960
 [96]  0.959048186 -0.904710149  0.336662905 -0.259902095 -1.459903494
> colSums(tmp)
  [1]  0.266780302 -1.385240463 -0.328497198 -0.358193454 -1.638503896
  [6] -0.518308188 -0.533664923 -0.661992596 -0.744826698  0.275301641
 [11] -0.984526552 -0.782650887  0.189105856 -0.488662590 -0.679058543
 [16]  0.197296758  0.315984738  0.604549352  0.053514007  0.988255124
 [21]  0.235879034 -0.046589037 -1.349360638  0.041229598  1.445216264
 [26] -0.384355484  1.799066595  0.607552629  0.810098102  0.120225542
 [31] -0.038144064 -0.107184960 -1.488030194 -0.063037205  0.207380455
 [36] -0.987542061 -0.288692341 -1.049847244  1.333258241  0.821974433
 [41]  0.147120025  0.552374329 -1.150882491  0.934643795  1.939455171
 [46] -0.633795649  0.538702291 -0.180331578 -0.842417822 -0.212718680
 [51] -0.751908613 -0.022704523  0.403193388  0.105986713  0.929471576
 [56]  0.297806837  1.610493642  0.828213230  2.741930083 -0.879962545
 [61] -0.376166034  1.448374115  1.006186368 -0.734869445 -0.348115586
 [66] -0.238395668 -1.308816137  2.640982766  0.626998468  0.700022763
 [71] -0.211936579 -0.438391489 -0.062517795  1.150487984 -0.781679195
 [76]  0.947090456  0.454414276  0.787889987 -0.033541555  0.092435260
 [81] -0.003415863  1.995851979  0.049249360  0.616403766  0.676339123
 [86] -0.614150834 -0.762148889  0.612176965  1.216256137  0.285323566
 [91] -0.225802983 -0.358259204  0.580246727  1.294273327 -1.306836960
 [96]  0.959048186 -0.904710149  0.336662905 -0.259902095 -1.459903494
> 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.266780302 -1.385240463 -0.328497198 -0.358193454 -1.638503896
  [6] -0.518308188 -0.533664923 -0.661992596 -0.744826698  0.275301641
 [11] -0.984526552 -0.782650887  0.189105856 -0.488662590 -0.679058543
 [16]  0.197296758  0.315984738  0.604549352  0.053514007  0.988255124
 [21]  0.235879034 -0.046589037 -1.349360638  0.041229598  1.445216264
 [26] -0.384355484  1.799066595  0.607552629  0.810098102  0.120225542
 [31] -0.038144064 -0.107184960 -1.488030194 -0.063037205  0.207380455
 [36] -0.987542061 -0.288692341 -1.049847244  1.333258241  0.821974433
 [41]  0.147120025  0.552374329 -1.150882491  0.934643795  1.939455171
 [46] -0.633795649  0.538702291 -0.180331578 -0.842417822 -0.212718680
 [51] -0.751908613 -0.022704523  0.403193388  0.105986713  0.929471576
 [56]  0.297806837  1.610493642  0.828213230  2.741930083 -0.879962545
 [61] -0.376166034  1.448374115  1.006186368 -0.734869445 -0.348115586
 [66] -0.238395668 -1.308816137  2.640982766  0.626998468  0.700022763
 [71] -0.211936579 -0.438391489 -0.062517795  1.150487984 -0.781679195
 [76]  0.947090456  0.454414276  0.787889987 -0.033541555  0.092435260
 [81] -0.003415863  1.995851979  0.049249360  0.616403766  0.676339123
 [86] -0.614150834 -0.762148889  0.612176965  1.216256137  0.285323566
 [91] -0.225802983 -0.358259204  0.580246727  1.294273327 -1.306836960
 [96]  0.959048186 -0.904710149  0.336662905 -0.259902095 -1.459903494
> colMin(tmp)
  [1]  0.266780302 -1.385240463 -0.328497198 -0.358193454 -1.638503896
  [6] -0.518308188 -0.533664923 -0.661992596 -0.744826698  0.275301641
 [11] -0.984526552 -0.782650887  0.189105856 -0.488662590 -0.679058543
 [16]  0.197296758  0.315984738  0.604549352  0.053514007  0.988255124
 [21]  0.235879034 -0.046589037 -1.349360638  0.041229598  1.445216264
 [26] -0.384355484  1.799066595  0.607552629  0.810098102  0.120225542
 [31] -0.038144064 -0.107184960 -1.488030194 -0.063037205  0.207380455
 [36] -0.987542061 -0.288692341 -1.049847244  1.333258241  0.821974433
 [41]  0.147120025  0.552374329 -1.150882491  0.934643795  1.939455171
 [46] -0.633795649  0.538702291 -0.180331578 -0.842417822 -0.212718680
 [51] -0.751908613 -0.022704523  0.403193388  0.105986713  0.929471576
 [56]  0.297806837  1.610493642  0.828213230  2.741930083 -0.879962545
 [61] -0.376166034  1.448374115  1.006186368 -0.734869445 -0.348115586
 [66] -0.238395668 -1.308816137  2.640982766  0.626998468  0.700022763
 [71] -0.211936579 -0.438391489 -0.062517795  1.150487984 -0.781679195
 [76]  0.947090456  0.454414276  0.787889987 -0.033541555  0.092435260
 [81] -0.003415863  1.995851979  0.049249360  0.616403766  0.676339123
 [86] -0.614150834 -0.762148889  0.612176965  1.216256137  0.285323566
 [91] -0.225802983 -0.358259204  0.580246727  1.294273327 -1.306836960
 [96]  0.959048186 -0.904710149  0.336662905 -0.259902095 -1.459903494
> colMedians(tmp)
  [1]  0.266780302 -1.385240463 -0.328497198 -0.358193454 -1.638503896
  [6] -0.518308188 -0.533664923 -0.661992596 -0.744826698  0.275301641
 [11] -0.984526552 -0.782650887  0.189105856 -0.488662590 -0.679058543
 [16]  0.197296758  0.315984738  0.604549352  0.053514007  0.988255124
 [21]  0.235879034 -0.046589037 -1.349360638  0.041229598  1.445216264
 [26] -0.384355484  1.799066595  0.607552629  0.810098102  0.120225542
 [31] -0.038144064 -0.107184960 -1.488030194 -0.063037205  0.207380455
 [36] -0.987542061 -0.288692341 -1.049847244  1.333258241  0.821974433
 [41]  0.147120025  0.552374329 -1.150882491  0.934643795  1.939455171
 [46] -0.633795649  0.538702291 -0.180331578 -0.842417822 -0.212718680
 [51] -0.751908613 -0.022704523  0.403193388  0.105986713  0.929471576
 [56]  0.297806837  1.610493642  0.828213230  2.741930083 -0.879962545
 [61] -0.376166034  1.448374115  1.006186368 -0.734869445 -0.348115586
 [66] -0.238395668 -1.308816137  2.640982766  0.626998468  0.700022763
 [71] -0.211936579 -0.438391489 -0.062517795  1.150487984 -0.781679195
 [76]  0.947090456  0.454414276  0.787889987 -0.033541555  0.092435260
 [81] -0.003415863  1.995851979  0.049249360  0.616403766  0.676339123
 [86] -0.614150834 -0.762148889  0.612176965  1.216256137  0.285323566
 [91] -0.225802983 -0.358259204  0.580246727  1.294273327 -1.306836960
 [96]  0.959048186 -0.904710149  0.336662905 -0.259902095 -1.459903494
> colRanges(tmp)
          [,1]     [,2]       [,3]       [,4]      [,5]       [,6]       [,7]
[1,] 0.2667803 -1.38524 -0.3284972 -0.3581935 -1.638504 -0.5183082 -0.5336649
[2,] 0.2667803 -1.38524 -0.3284972 -0.3581935 -1.638504 -0.5183082 -0.5336649
           [,8]       [,9]     [,10]      [,11]      [,12]     [,13]      [,14]
[1,] -0.6619926 -0.7448267 0.2753016 -0.9845266 -0.7826509 0.1891059 -0.4886626
[2,] -0.6619926 -0.7448267 0.2753016 -0.9845266 -0.7826509 0.1891059 -0.4886626
          [,15]     [,16]     [,17]     [,18]      [,19]     [,20]    [,21]
[1,] -0.6790585 0.1972968 0.3159847 0.6045494 0.05351401 0.9882551 0.235879
[2,] -0.6790585 0.1972968 0.3159847 0.6045494 0.05351401 0.9882551 0.235879
           [,22]     [,23]     [,24]    [,25]      [,26]    [,27]     [,28]
[1,] -0.04658904 -1.349361 0.0412296 1.445216 -0.3843555 1.799067 0.6075526
[2,] -0.04658904 -1.349361 0.0412296 1.445216 -0.3843555 1.799067 0.6075526
         [,29]     [,30]       [,31]     [,32]    [,33]       [,34]     [,35]
[1,] 0.8100981 0.1202255 -0.03814406 -0.107185 -1.48803 -0.06303721 0.2073805
[2,] 0.8100981 0.1202255 -0.03814406 -0.107185 -1.48803 -0.06303721 0.2073805
          [,36]      [,37]     [,38]    [,39]     [,40]   [,41]     [,42]
[1,] -0.9875421 -0.2886923 -1.049847 1.333258 0.8219744 0.14712 0.5523743
[2,] -0.9875421 -0.2886923 -1.049847 1.333258 0.8219744 0.14712 0.5523743
         [,43]     [,44]    [,45]      [,46]     [,47]      [,48]      [,49]
[1,] -1.150882 0.9346438 1.939455 -0.6337956 0.5387023 -0.1803316 -0.8424178
[2,] -1.150882 0.9346438 1.939455 -0.6337956 0.5387023 -0.1803316 -0.8424178
          [,50]      [,51]       [,52]     [,53]     [,54]     [,55]     [,56]
[1,] -0.2127187 -0.7519086 -0.02270452 0.4031934 0.1059867 0.9294716 0.2978068
[2,] -0.2127187 -0.7519086 -0.02270452 0.4031934 0.1059867 0.9294716 0.2978068
        [,57]     [,58]   [,59]      [,60]     [,61]    [,62]    [,63]
[1,] 1.610494 0.8282132 2.74193 -0.8799625 -0.376166 1.448374 1.006186
[2,] 1.610494 0.8282132 2.74193 -0.8799625 -0.376166 1.448374 1.006186
          [,64]      [,65]      [,66]     [,67]    [,68]     [,69]     [,70]
[1,] -0.7348694 -0.3481156 -0.2383957 -1.308816 2.640983 0.6269985 0.7000228
[2,] -0.7348694 -0.3481156 -0.2383957 -1.308816 2.640983 0.6269985 0.7000228
          [,71]      [,72]       [,73]    [,74]      [,75]     [,76]     [,77]
[1,] -0.2119366 -0.4383915 -0.06251779 1.150488 -0.7816792 0.9470905 0.4544143
[2,] -0.2119366 -0.4383915 -0.06251779 1.150488 -0.7816792 0.9470905 0.4544143
       [,78]       [,79]      [,80]        [,81]    [,82]      [,83]     [,84]
[1,] 0.78789 -0.03354156 0.09243526 -0.003415863 1.995852 0.04924936 0.6164038
[2,] 0.78789 -0.03354156 0.09243526 -0.003415863 1.995852 0.04924936 0.6164038
         [,85]      [,86]      [,87]    [,88]    [,89]     [,90]     [,91]
[1,] 0.6763391 -0.6141508 -0.7621489 0.612177 1.216256 0.2853236 -0.225803
[2,] 0.6763391 -0.6141508 -0.7621489 0.612177 1.216256 0.2853236 -0.225803
          [,92]     [,93]    [,94]     [,95]     [,96]      [,97]     [,98]
[1,] -0.3582592 0.5802467 1.294273 -1.306837 0.9590482 -0.9047101 0.3366629
[2,] -0.3582592 0.5802467 1.294273 -1.306837 0.9590482 -0.9047101 0.3366629
          [,99]    [,100]
[1,] -0.2599021 -1.459903
[2,] -0.2599021 -1.459903
> 
> 
> Max(tmp2)
[1] 3.206771
> Min(tmp2)
[1] -2.197405
> mean(tmp2)
[1] 0.05137597
> Sum(tmp2)
[1] 5.137597
> Var(tmp2)
[1] 0.9855723
> 
> rowMeans(tmp2)
  [1]  1.406426826 -0.850961900 -0.586613727  0.086254937 -0.677302708
  [6]  0.685097472  1.090338287  1.056878301 -0.741386695  0.081520040
 [11]  0.493040379  0.970831567  0.849078735  0.247663617 -1.265358621
 [16]  1.034864782 -0.252829742  2.043326648  0.893301310 -2.088914230
 [21] -0.004144960  0.958303701 -0.998983347 -0.465704913  0.260639460
 [26]  0.259596326 -0.339760793  0.468536621  0.462320287  1.651801204
 [31]  0.897634236 -0.113517088  1.342734956  0.215842106  1.119299049
 [36]  0.448783094  0.194847501 -0.948415759 -0.657287803  1.345242005
 [41]  0.615913336  0.688847446 -0.585293890  1.850660735 -0.788976253
 [46] -0.372305730  0.539020624  1.118849001  1.342716016 -1.900238534
 [51] -0.467719512 -0.740219631  0.038155132  0.163397996 -0.304649684
 [56] -0.272123610  0.728254270  0.964292545  3.206771356  0.142553955
 [61] -2.197405262 -0.628738225 -0.292284958 -1.100714001  1.362983627
 [66] -1.475554553 -0.191188635  0.363618312 -0.032331331 -0.268905010
 [71]  1.462903850 -0.506136351 -0.991540338  1.137968358 -0.810869567
 [76]  1.179669729 -0.250759482 -1.759323605  0.791662639 -1.053414883
 [81] -0.635919208  1.563180684 -0.972202689  0.005233318  0.148085582
 [86] -0.231607297 -0.737978077  0.672730409 -0.579687944 -1.222834935
 [91]  0.925207504 -1.490820562  0.004511866 -2.085334894  0.362921827
 [96]  0.278834279 -0.228801639 -1.392242572  0.020113204 -0.546358586
> rowSums(tmp2)
  [1]  1.406426826 -0.850961900 -0.586613727  0.086254937 -0.677302708
  [6]  0.685097472  1.090338287  1.056878301 -0.741386695  0.081520040
 [11]  0.493040379  0.970831567  0.849078735  0.247663617 -1.265358621
 [16]  1.034864782 -0.252829742  2.043326648  0.893301310 -2.088914230
 [21] -0.004144960  0.958303701 -0.998983347 -0.465704913  0.260639460
 [26]  0.259596326 -0.339760793  0.468536621  0.462320287  1.651801204
 [31]  0.897634236 -0.113517088  1.342734956  0.215842106  1.119299049
 [36]  0.448783094  0.194847501 -0.948415759 -0.657287803  1.345242005
 [41]  0.615913336  0.688847446 -0.585293890  1.850660735 -0.788976253
 [46] -0.372305730  0.539020624  1.118849001  1.342716016 -1.900238534
 [51] -0.467719512 -0.740219631  0.038155132  0.163397996 -0.304649684
 [56] -0.272123610  0.728254270  0.964292545  3.206771356  0.142553955
 [61] -2.197405262 -0.628738225 -0.292284958 -1.100714001  1.362983627
 [66] -1.475554553 -0.191188635  0.363618312 -0.032331331 -0.268905010
 [71]  1.462903850 -0.506136351 -0.991540338  1.137968358 -0.810869567
 [76]  1.179669729 -0.250759482 -1.759323605  0.791662639 -1.053414883
 [81] -0.635919208  1.563180684 -0.972202689  0.005233318  0.148085582
 [86] -0.231607297 -0.737978077  0.672730409 -0.579687944 -1.222834935
 [91]  0.925207504 -1.490820562  0.004511866 -2.085334894  0.362921827
 [96]  0.278834279 -0.228801639 -1.392242572  0.020113204 -0.546358586
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  1.406426826 -0.850961900 -0.586613727  0.086254937 -0.677302708
  [6]  0.685097472  1.090338287  1.056878301 -0.741386695  0.081520040
 [11]  0.493040379  0.970831567  0.849078735  0.247663617 -1.265358621
 [16]  1.034864782 -0.252829742  2.043326648  0.893301310 -2.088914230
 [21] -0.004144960  0.958303701 -0.998983347 -0.465704913  0.260639460
 [26]  0.259596326 -0.339760793  0.468536621  0.462320287  1.651801204
 [31]  0.897634236 -0.113517088  1.342734956  0.215842106  1.119299049
 [36]  0.448783094  0.194847501 -0.948415759 -0.657287803  1.345242005
 [41]  0.615913336  0.688847446 -0.585293890  1.850660735 -0.788976253
 [46] -0.372305730  0.539020624  1.118849001  1.342716016 -1.900238534
 [51] -0.467719512 -0.740219631  0.038155132  0.163397996 -0.304649684
 [56] -0.272123610  0.728254270  0.964292545  3.206771356  0.142553955
 [61] -2.197405262 -0.628738225 -0.292284958 -1.100714001  1.362983627
 [66] -1.475554553 -0.191188635  0.363618312 -0.032331331 -0.268905010
 [71]  1.462903850 -0.506136351 -0.991540338  1.137968358 -0.810869567
 [76]  1.179669729 -0.250759482 -1.759323605  0.791662639 -1.053414883
 [81] -0.635919208  1.563180684 -0.972202689  0.005233318  0.148085582
 [86] -0.231607297 -0.737978077  0.672730409 -0.579687944 -1.222834935
 [91]  0.925207504 -1.490820562  0.004511866 -2.085334894  0.362921827
 [96]  0.278834279 -0.228801639 -1.392242572  0.020113204 -0.546358586
> rowMin(tmp2)
  [1]  1.406426826 -0.850961900 -0.586613727  0.086254937 -0.677302708
  [6]  0.685097472  1.090338287  1.056878301 -0.741386695  0.081520040
 [11]  0.493040379  0.970831567  0.849078735  0.247663617 -1.265358621
 [16]  1.034864782 -0.252829742  2.043326648  0.893301310 -2.088914230
 [21] -0.004144960  0.958303701 -0.998983347 -0.465704913  0.260639460
 [26]  0.259596326 -0.339760793  0.468536621  0.462320287  1.651801204
 [31]  0.897634236 -0.113517088  1.342734956  0.215842106  1.119299049
 [36]  0.448783094  0.194847501 -0.948415759 -0.657287803  1.345242005
 [41]  0.615913336  0.688847446 -0.585293890  1.850660735 -0.788976253
 [46] -0.372305730  0.539020624  1.118849001  1.342716016 -1.900238534
 [51] -0.467719512 -0.740219631  0.038155132  0.163397996 -0.304649684
 [56] -0.272123610  0.728254270  0.964292545  3.206771356  0.142553955
 [61] -2.197405262 -0.628738225 -0.292284958 -1.100714001  1.362983627
 [66] -1.475554553 -0.191188635  0.363618312 -0.032331331 -0.268905010
 [71]  1.462903850 -0.506136351 -0.991540338  1.137968358 -0.810869567
 [76]  1.179669729 -0.250759482 -1.759323605  0.791662639 -1.053414883
 [81] -0.635919208  1.563180684 -0.972202689  0.005233318  0.148085582
 [86] -0.231607297 -0.737978077  0.672730409 -0.579687944 -1.222834935
 [91]  0.925207504 -1.490820562  0.004511866 -2.085334894  0.362921827
 [96]  0.278834279 -0.228801639 -1.392242572  0.020113204 -0.546358586
> 
> colMeans(tmp2)
[1] 0.05137597
> colSums(tmp2)
[1] 5.137597
> colVars(tmp2)
[1] 0.9855723
> colSd(tmp2)
[1] 0.9927599
> colMax(tmp2)
[1] 3.206771
> colMin(tmp2)
[1] -2.197405
> colMedians(tmp2)
[1] 0.02913417
> colRanges(tmp2)
          [,1]
[1,] -2.197405
[2,]  3.206771
> 
> 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.5805664  3.5074737 -4.2854151  0.4854994 -2.2645679 -4.3410172
 [7]  2.3109357 -4.7294175  2.4389254  1.0229721
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.15216325
[2,] -1.09941258
[3,] -0.02154166
[4,]  0.85812811
[5,]  1.19481142
> 
> rowApply(tmp,sum)
 [1]  3.4786723 -5.5593797 -0.4129443  0.1050779 -1.1929085 -2.9188355
 [7] -7.1824294  2.1254743  0.6310154  3.4910797
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7   10    6    6    3    2    1    1   10     8
 [2,]   10    1    8    9    7   10    9    4    1    10
 [3,]    4    8    3    4    1    4    2    8    9     4
 [4,]    3    2    7    2    9    5    5   10    7     9
 [5,]    2    5    5    3    2    8    7    2    8     5
 [6,]    9    4    1    5    5    1    3    9    6     6
 [7,]    5    3   10    8    8    3    8    7    2     7
 [8,]    1    6    4    7    4    7    4    3    4     2
 [9,]    6    7    9    1   10    6   10    6    5     3
[10,]    8    9    2   10    6    9    6    5    3     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.3885386  0.1295419 -4.6164606  0.3527160  0.5961563  4.0561276
 [7] -1.0164585  0.1192089 -1.1982698 -1.0178006  0.5434294  0.7681440
[13] -0.0514960  0.7270001 -1.8664816 -0.1988539 -0.9213921 -2.6583147
[19] -1.4159822 -0.3082956
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8335305
[2,] -0.1214399
[3,]  0.4080492
[4,]  1.0666176
[5,]  1.8688422
> 
> rowApply(tmp,sum)
[1] -11.9066053  -1.8506472   0.2266809   2.3164689   4.6251600
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   15   17    2    7   18
[2,]   10   11   15   15    6
[3,]   16    1    1    2    7
[4,]   20    8   11   14    4
[5,]    2    5    9   19   20
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  0.4080492 -0.6205482  0.5206016  0.8389824 -1.99605540 -0.2969231
[2,]  1.0666176 -0.2985723 -1.4679415 -0.7665283 -1.03254034  2.2302790
[3,] -1.8335305  0.9367693 -2.1866442  0.2102362  0.01421431  1.4474488
[4,] -0.1214399  0.5258879 -1.2603151  0.5081956  1.38156605  0.2517336
[5,]  1.8688422 -0.4139948 -0.2221614 -0.4381699  2.22897171  0.4235892
            [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.59996192  0.53663032 -2.2167889 -1.7754786  0.5436115 -1.4680734
[2,]  0.49278860 -0.90907585 -0.6656346  1.8288764  1.4202671  0.4720004
[3,] -1.37487011  1.02562573  2.1750668 -0.1599586 -1.4937250  1.4282432
[4,]  0.41349712 -0.03578058  1.0144118 -1.1488055 -0.7431187  0.5341762
[5,]  0.05208782 -0.49819071 -1.5053249  0.2375656  0.8163945 -0.1982025
          [,13]      [,14]      [,15]       [,16]      [,17]      [,18]
[1,] -1.5855866  0.2441402 -1.3316081  0.56169601 -1.7569475 -0.6387445
[2,]  0.1367437 -0.8772638 -1.0468097  0.38776583  0.1661983 -1.1200484
[3,]  0.2240678  1.0103007  0.4399175  0.07175944  0.7875386 -1.4657124
[4,]  1.6048689 -1.5426058  0.2935774 -0.32776666 -0.6462213  0.1888827
[5,] -0.4315897  1.8924288 -0.2215587 -0.89230855  0.5280397  0.3773079
          [,19]      [,20]
[1,] -0.5789882 -0.6946122
[2,] -1.3451616 -0.5226079
[3,] -0.3345565 -0.6955102
[4,]  1.0397311  0.3859940
[5,] -0.1970070  1.2184406
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  626  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  542  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  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.9881639 0.8424552 -0.1178344 0.9643328 -1.771864 0.144223 -1.29201
            col8      col9   col10       col11      col12     col13      col14
row1 -0.08171623 -1.980258 -1.2515 -0.04211254 -0.8626649 -1.119964 -0.0547491
          col15       col16    col17      col18    col19    col20
row1 -0.2813378 -0.02463443 1.828854 -0.1705101 -1.62418 1.051869
> tmp[,"col10"]
          col10
row1 -1.2514997
row2 -0.8428914
row3 -0.4231374
row4 -0.5335053
row5  0.9521972
> tmp[c("row1","row5"),]
            col1       col2       col3       col4      col5     col6      col7
row1 -0.98816387  0.8424552 -0.1178344  0.9643328 -1.771864 0.144223 -1.292010
row5  0.08117055 -1.1058975 -0.4157133 -1.1161215  2.084823 1.459562  1.074825
            col8       col9      col10       col11      col12      col13
row1 -0.08171623 -1.9802579 -1.2514997 -0.04211254 -0.8626649 -1.1199637
row5 -0.56149871  0.4008333  0.9521972 -0.22241848 -0.4527431  0.1439763
          col14      col15       col16     col17      col18      col19
row1 -0.0547491 -0.2813378 -0.02463443 1.8288543 -0.1705101 -1.6241800
row5 -0.2025294 -0.6613795  0.51415000 0.6787669 -1.7051640  0.7398434
          col20
row1  1.0518689
row5 -0.5362003
> tmp[,c("col6","col20")]
          col6      col20
row1 0.1442230  1.0518689
row2 0.3650734  2.0806343
row3 0.2174769  0.0537134
row4 0.5450906 -1.1772673
row5 1.4595624 -0.5362003
> tmp[c("row1","row5"),c("col6","col20")]
         col6      col20
row1 0.144223  1.0518689
row5 1.459562 -0.5362003
> 
> 
> 
> 
> 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.10555 50.3525 50.35679 52.31398 50.7484 106.3382 51.29728 48.99614
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.70079 49.66958 50.36642 50.84534 50.97169 48.30889 49.23294 51.42526
        col17    col18    col19    col20
row1 49.78574 50.29296 49.41897 106.7124
> tmp[,"col10"]
        col10
row1 49.66958
row2 28.94890
row3 30.23837
row4 29.47306
row5 49.76081
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.10555 50.35250 50.35679 52.31398 50.74840 106.3382 51.29728 48.99614
row5 48.82847 49.59583 48.85717 50.68683 50.82995 104.9610 48.98760 49.95259
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.70079 49.66958 50.36642 50.84534 50.97169 48.30889 49.23294 51.42526
row5 52.26498 49.76081 50.43270 49.46552 50.23849 49.65788 50.86011 49.61520
        col17    col18    col19    col20
row1 49.78574 50.29296 49.41897 106.7124
row5 49.27693 49.92176 50.85886 104.4829
> tmp[,c("col6","col20")]
          col6     col20
row1 106.33819 106.71243
row2  74.68868  73.91533
row3  74.41775  75.92145
row4  75.03944  75.15001
row5 104.96103 104.48290
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.3382 106.7124
row5 104.9610 104.4829
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.3382 106.7124
row5 104.9610 104.4829
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.9784832
[2,]  1.3222833
[3,]  1.5124945
[4,]  0.5874738
[5,]  0.5738473
> tmp[,c("col17","col7")]
          col17        col7
[1,]  1.8816184 -0.17432412
[2,]  1.6490977 -0.28646128
[3,] -0.8820788  0.65134412
[4,]  0.4136512 -1.15420186
[5,]  1.2908582  0.06040057
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -0.1049863 -0.56123885
[2,]  0.8250996 -0.09113784
[3,] -0.9886018  0.44837234
[4,]  0.3739049 -0.02950677
[5,]  0.7378343  0.05699919
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.1049863
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.1049863
[2,]  0.8250996
> 
> 
> 
> 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.7165075 -0.00461643  2.2622601 1.573052 -2.020426  1.8778493 -1.0989882
row1 -0.2022056  0.60378937 -0.6078823 1.189109 -1.300571 -0.8572035 -0.5591544
           [,8]     [,9]     [,10]      [,11]      [,12]      [,13]      [,14]
row3  0.4816076 1.163053 -1.134446 -0.1287146 -0.2961603 -0.1154169 -0.2123179
row1 -0.5202340 0.418902  1.225409 -0.1997696 -0.8942885 -0.3703318  0.5535099
         [,15]      [,16]     [,17]      [,18]      [,19]      [,20]
row3  1.247151  1.0794711 0.1187745 -0.8096871  1.4520695  0.9500562
row1 -1.793658 -0.2153047 0.9752787  0.5427731 -0.1215224 -1.1717263
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]      [,4]      [,5]     [,6]       [,7]
row2 0.3721931 1.089646 -2.741292 0.4257214 -1.496089 1.111174 0.06736277
            [,8]      [,9]     [,10]
row2 -0.06023348 0.5012281 0.1985409
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]       [,5]       [,6]     [,7]
row5 -1.849886 -0.5958129 0.6153139 -1.003025 -0.5182446 -0.1182636 1.446647
           [,8]     [,9]     [,10]    [,11]     [,12]     [,13]      [,14]
row5 -0.9224283 1.963225 -0.429307 1.436108 0.6134317 -2.475905 0.08927247
         [,15]      [,16]      [,17]       [,18]     [,19]     [,20]
row5 0.8411194 0.03887787 -0.4260124 -0.08717947 0.9668309 0.2030105
> 
> 
> 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: 0x000001a6950fa230>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c33a56f8b"
 [2] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c38067804"
 [3] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c1ea408"  
 [4] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c65f37050"
 [5] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c460b16d7"
 [6] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c5d2f13e3"
 [7] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c76c5c94" 
 [8] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c55744ad9"
 [9] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c6dcf61e8"
[10] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c7b5c67b6"
[11] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c6ab47308"
[12] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c29d44b06"
[13] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c37df5c7e"
[14] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c57ce6a40"
[15] "F:/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests\\BM523c25f4592c"
> 
> 
> ### 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: 0x000001a6966ff950>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x000001a6966ff950>
Warning message:
In dir.create(new.directory) :
  'F:\biocbuild\bbs-3.20-bioc\meat\BufferedMatrix.Rcheck\tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x000001a6966ff950>
> rowMedians(tmp)
  [1] -0.643593071  0.341088503  0.653866375 -0.174845407  0.260409928
  [6] -0.022616385  0.290177388 -0.458465081 -0.385638494 -0.194584034
 [11] -0.046913136 -0.112697005 -0.050418034 -1.148804268  0.182493539
 [16]  0.046352163  0.087882927  0.380558669 -0.263683188 -0.515418359
 [21] -0.003627213 -0.112559663 -0.038387652 -0.078031627  0.275537627
 [26]  0.364467526 -0.359424583  0.152765522 -0.114123197 -0.596348040
 [31] -0.379182931 -0.240737280  0.349419697 -0.038410603 -0.547795237
 [36]  0.023163348 -0.205011399  0.279106621  0.126999439 -0.202485508
 [41] -0.506170124  0.161095327 -0.200512951  0.303959019  0.311761412
 [46] -0.627035192 -0.044021214 -0.009268048  0.274946956 -0.561033589
 [51]  0.312250707 -0.220868430 -0.057142441  0.542978165 -0.029132533
 [56]  0.178411925  0.251639861  0.068747064 -0.382728805  0.084197480
 [61] -0.148042468 -0.530715375  0.438284537 -0.150274577 -0.559028092
 [66]  0.173512452  0.734659040  0.077068695  0.394578609  0.083013403
 [71] -0.102463093  0.297115274 -0.214149098  0.313043815 -0.258250360
 [76]  0.052676213  0.365935250 -0.115298143  0.099953533 -0.596869385
 [81]  0.513596304  0.172602660 -0.491539331  0.117483651 -0.216756805
 [86]  0.316362404 -0.147028097  0.364624148 -0.405280698  0.067715201
 [91]  0.554434959 -0.289756204  0.316181809 -0.246411141  0.058389357
 [96]  0.116052767 -0.210938481 -0.192290063  0.192864280 -0.788277465
[101] -0.387883791  0.027922140  0.130755422 -0.009310259  0.125730699
[106]  0.107473668  0.273986775 -0.374433965 -0.006543030 -0.248981158
[111]  0.056895529 -0.184249654  0.325927349  0.359189769  0.150290824
[116] -0.309707573  0.755471647  0.521887799 -0.151708207 -0.299930791
[121] -0.560121002 -0.174086984  0.324649056  0.182074560  0.736286637
[126] -0.158500459  0.067997785 -0.185219210  0.197694258 -0.448480685
[131]  0.211167954  0.180574187 -0.165274488 -0.161338495 -0.399329554
[136] -0.183025920 -0.111816109 -0.197368854 -0.102986491 -0.195193805
[141]  0.079306170 -0.040875543 -0.059757062  0.169420558 -0.122418211
[146] -0.261686668  0.266303991 -0.386565838  0.020971088 -0.237581841
[151] -0.110147540 -0.801154829 -0.114477800 -0.141730651 -0.020881799
[156]  0.204794031  0.131076293  0.081030597 -0.145070935 -0.193048875
[161]  0.142925625 -0.445069424  0.310324325  0.208097494 -0.065014119
[166] -0.387286516 -0.223787354 -0.156193652  0.243987846  0.301576537
[171]  0.294955559 -0.076303790 -0.222177806  0.440020683 -0.178678372
[176] -0.384738698 -0.161029354  0.477002862  0.118761298 -0.250560121
[181]  0.051779206 -0.155388530 -0.312205775  0.548561419 -0.203287378
[186] -0.232328178 -0.269636214 -0.106100162 -0.860956977  0.417486535
[191]  0.153783815  0.209940697  0.380232906 -0.251999367  0.286299202
[196]  0.116143511  0.375329068 -0.123513438 -0.348794405  0.026026995
[201]  0.052619278  0.101772881  0.034324518 -0.467878227  0.665855345
[206]  0.401367190  0.005764472  0.553294061 -0.390039568 -0.065222512
[211]  0.152185913 -0.002805568 -0.047314486  0.046529962  0.233719505
[216] -0.144738759  0.070437049  0.003102116  0.028637380 -0.631852989
[221] -0.152776196  0.445388071  0.597653945  0.103002489 -0.227584937
[226]  0.206356691 -0.071412228  0.088042716 -0.436758667  0.396181659
> 
> proc.time()
   user  system elapsed 
   3.92   16.12  322.48 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.2 (2024-10-31 ucrt) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

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: 0x0000020cfeafe410>
> .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: 0x0000020cfeafe410>
> .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: 0x0000020cfeafe410>
> .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: 0x0000020cfeafe410>
> 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: 0x0000020cfeafe950>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafe950>
> .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: 0x0000020cfeafe950>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafe950>
> .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: 0x0000020cfeafe950>
> 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: 0x0000020cfeafe110>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafe110>
> .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: 0x0000020cfeafe110>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000020cfeafe110>
> .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: 0x0000020cfeafe110>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000020cfeafe110>
> .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: 0x0000020cfeafe110>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000020cfeafe110>
> .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: 0x0000020cfeafe110>
> 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: 0x0000020cfeafed70>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000020cfeafed70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafed70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafed70>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1ed28294ede"   "BufferedMatrixFile1ed284ba74821"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1ed28294ede"   "BufferedMatrixFile1ed284ba74821"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafecb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020cfeafecb0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000020cfeafecb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000020cfeafecb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000020cfeafecb0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000020cfeafecb0>
> .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: 0x0000020d00efd170>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000020d00efd170>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000020d00efd170>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000020d00efd170>
> 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: 0x0000020d00efd470>
> .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: 0x0000020d00efd470>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.28    0.21    1.06 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.2 (2024-10-31 ucrt) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

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.25    0.10    0.34 

Example timings