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

This page was generated on 2025-12-11 12:07 -0500 (Thu, 11 Dec 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4879
merida1macOS 12.7.6 Montereyx86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4670
kjohnson1macOS 13.7.5 Venturaarm644.5.2 Patched (2025-11-04 r88984) -- "[Not] Part in a Rumble" 4604
taishanLinux (openEuler 24.03 LTS)aarch644.5.0 (2025-04-11) -- "How About a Twenty-Six" 4669
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 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-12-08 13:45 -0500 (Mon, 08 Dec 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 12.7.6 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson1macOS 13.7.5 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 taishan

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.
- See Martin Grigorov's blog post for how to debug Linux ARM64 related issues on a x86_64 host.

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/R/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R/site-library --no-vignettes --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2025-12-09 08:25:40 -0000 (Tue, 09 Dec 2025)
EndedAt: 2025-12-09 08:26:10 -0000 (Tue, 09 Dec 2025)
EllapsedTime: 30.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R/site-library --no-vignettes --timings BufferedMatrix_1.74.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.5.0 (2025-04-11)
* using platform: aarch64-unknown-linux-gnu
* R was compiled by
    aarch64-unknown-linux-gnu-gcc (GCC) 14.2.0
    GNU Fortran (GCC) 14.2.0
* running under: openEuler 24.03 (LTS)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.74.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 for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘aarch64-unknown-linux-gnu-gcc (GCC) 14.2.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 loading without being on the library search path ... 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 is not available
* 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
  ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/R/R-4.5.0/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.74.0’
** using staged installation
** libs
using C compiler: ‘aarch64-unknown-linux-gnu-gcc (GCC) 14.2.0’
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c RBufferedMatrix.c -o RBufferedMatrix.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -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){
      |            ^~~~~~~~~~~
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c init_package.c -o init_package.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -shared -L/home/biocbuild/R/R-4.5.0/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/R/R-4.5.0/lib -lR
installing to /home/biocbuild/R/R-4.5.0/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** 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
** checking absolute paths in shared objects and dynamic libraries
** 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.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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.317   0.040   0.344 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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] "/home/biocbuild/bbs-3.22-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 478398 25.6    1047041   56   639620 34.2
Vcells 885166  6.8    8388608   64  2080985 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Dec  9 08:26:04 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] "Tue Dec  9 08:26:04 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: 0x171bfff0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Dec  9 08:26:05 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] "Tue Dec  9 08:26:05 2025"
> 
> ColMode(tmp2)
<pointer: 0x171bfff0>
> 
> 
> 
> ### 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.5673372  0.007835161  2.0003406 -1.76262790
[2,]  -0.2086617  0.559818799  1.6828124 -0.02795953
[3,]  -0.1638023 -0.920906534  0.5761935  1.47319708
[4,]  -0.4687021 -0.233380414 -0.3202454 -1.70774358
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-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.5673372 0.007835161 2.0003406 1.76262790
[2,]   0.2086617 0.559818799 1.6828124 0.02795953
[3,]   0.1638023 0.920906534 0.5761935 1.47319708
[4,]   0.4687021 0.233380414 0.3202454 1.70774358
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-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.0283267 0.08851644 1.4143340 1.327640
[2,]  0.4567951 0.74821040 1.2972326 0.167211
[3,]  0.4047250 0.95963875 0.7590741 1.213753
[4,]  0.6846182 0.48309462 0.5659023 1.306807
> 
> 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:    /home/biocbuild/bbs-3.22-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.85060 25.89300 41.14368 40.03903
[2,]  29.77661 33.04192 39.65514 26.70007
[3,]  29.21105 35.51729 33.16693 38.61073
[4,]  32.31488 30.06433 30.97927 39.77581
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x15ea26c0>
> exp(tmp5)
<pointer: 0x15ea26c0>
> log(tmp5,2)
<pointer: 0x15ea26c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.0784
> Min(tmp5)
[1] 52.49175
> mean(tmp5)
[1] 72.04736
> Sum(tmp5)
[1] 14409.47
> Var(tmp5)
[1] 881.2579
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.00131 67.10483 69.39471 71.67669 70.68739 71.61272 67.29527 69.66583
 [9] 67.86138 72.17351
> rowSums(tmp5)
 [1] 1860.026 1342.097 1387.894 1433.534 1413.748 1432.254 1345.905 1393.317
 [9] 1357.228 1443.470
> rowVars(tmp5)
 [1] 7973.70588   84.97966   60.45265   65.67122   81.15027   51.33352
 [7]   68.33091   95.13041  115.57664   87.89546
> rowSd(tmp5)
 [1] 89.295610  9.218442  7.775130  8.103778  9.008344  7.164741  8.266251
 [8]  9.753482 10.750658  9.375258
> rowMax(tmp5)
 [1] 470.07844  82.53697  80.36318  84.38586  85.31078  84.90003  83.18981
 [8]  93.73607  84.96264  93.69936
> rowMin(tmp5)
 [1] 53.89289 53.64444 54.00593 56.42157 58.52720 60.01640 55.57809 58.12456
 [9] 52.49175 55.83121
> 
> colMeans(tmp5)
 [1] 109.06221  65.04626  71.46056  72.33829  70.85801  71.41338  68.10078
 [8]  70.11040  65.39421  72.60329  68.57863  77.75578  68.18260  64.48331
[15]  69.80795  65.81290  74.98186  68.84511  74.87772  71.23402
> colSums(tmp5)
 [1] 1090.6221  650.4626  714.6056  723.3829  708.5801  714.1338  681.0078
 [8]  701.1040  653.9421  726.0329  685.7863  777.5578  681.8260  644.8331
[15]  698.0795  658.1290  749.8186  688.4511  748.7772  712.3402
> colVars(tmp5)
 [1] 16152.27165    53.09698    84.12040   117.90366   112.63475    71.42248
 [7]    75.18067    42.02231    74.75638    51.16015    87.45507    57.73496
[13]   205.75235    53.74019    55.18961    68.08698    52.12929    42.48190
[19]    87.33647    81.72485
> colSd(tmp5)
 [1] 127.091588   7.286767   9.171717  10.858345  10.612952   8.451182
 [7]   8.670679   6.482462   8.646177   7.152632   9.351742   7.598352
[13]  14.344070   7.330770   7.428971   8.251484   7.220062   6.517814
[19]   9.345398   9.040180
> colMax(tmp5)
 [1] 470.07844  76.75436  85.63518  83.33599  84.99070  84.02401  81.79432
 [8]  77.26702  77.46549  82.64538  84.90003  86.90702  93.73607  77.69771
[15]  81.17744  78.48040  87.85235  80.74550  93.76177  85.31078
> colMin(tmp5)
 [1] 60.79898 53.89289 61.27352 55.57270 54.00593 58.12456 53.64444 55.10286
 [9] 53.92628 56.72447 55.25935 59.78232 55.57809 56.42157 58.07975 52.49175
[17] 67.35627 60.12767 62.17333 60.75003
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 93.00131 67.10483 69.39471 71.67669       NA 71.61272 67.29527 69.66583
 [9] 67.86138 72.17351
> rowSums(tmp5)
 [1] 1860.026 1342.097 1387.894 1433.534       NA 1432.254 1345.905 1393.317
 [9] 1357.228 1443.470
> rowVars(tmp5)
 [1] 7973.70588   84.97966   60.45265   65.67122   78.44435   51.33352
 [7]   68.33091   95.13041  115.57664   87.89546
> rowSd(tmp5)
 [1] 89.295610  9.218442  7.775130  8.103778  8.856882  7.164741  8.266251
 [8]  9.753482 10.750658  9.375258
> rowMax(tmp5)
 [1] 470.07844  82.53697  80.36318  84.38586        NA  84.90003  83.18981
 [8]  93.73607  84.96264  93.69936
> rowMin(tmp5)
 [1] 53.89289 53.64444 54.00593 56.42157       NA 60.01640 55.57809 58.12456
 [9] 52.49175 55.83121
> 
> colMeans(tmp5)
 [1] 109.06221  65.04626  71.46056  72.33829  70.85801  71.41338        NA
 [8]  70.11040  65.39421  72.60329  68.57863  77.75578  68.18260  64.48331
[15]  69.80795  65.81290  74.98186  68.84511  74.87772  71.23402
> colSums(tmp5)
 [1] 1090.6221  650.4626  714.6056  723.3829  708.5801  714.1338        NA
 [8]  701.1040  653.9421  726.0329  685.7863  777.5578  681.8260  644.8331
[15]  698.0795  658.1290  749.8186  688.4511  748.7772  712.3402
> colVars(tmp5)
 [1] 16152.27165    53.09698    84.12040   117.90366   112.63475    71.42248
 [7]          NA    42.02231    74.75638    51.16015    87.45507    57.73496
[13]   205.75235    53.74019    55.18961    68.08698    52.12929    42.48190
[19]    87.33647    81.72485
> colSd(tmp5)
 [1] 127.091588   7.286767   9.171717  10.858345  10.612952   8.451182
 [7]         NA   6.482462   8.646177   7.152632   9.351742   7.598352
[13]  14.344070   7.330770   7.428971   8.251484   7.220062   6.517814
[19]   9.345398   9.040180
> colMax(tmp5)
 [1] 470.07844  76.75436  85.63518  83.33599  84.99070  84.02401        NA
 [8]  77.26702  77.46549  82.64538  84.90003  86.90702  93.73607  77.69771
[15]  81.17744  78.48040  87.85235  80.74550  93.76177  85.31078
> colMin(tmp5)
 [1] 60.79898 53.89289 61.27352 55.57270 54.00593 58.12456       NA 55.10286
 [9] 53.92628 56.72447 55.25935 59.78232 55.57809 56.42157 58.07975 52.49175
[17] 67.35627 60.12767 62.17333 60.75003
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.0784
> Min(tmp5,na.rm=TRUE)
[1] 52.49175
> mean(tmp5,na.rm=TRUE)
[1] 71.99838
> Sum(tmp5,na.rm=TRUE)
[1] 14327.68
> Var(tmp5,na.rm=TRUE)
[1] 885.2265
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.00131 67.10483 69.39471 71.67669 70.10282 71.61272 67.29527 69.66583
 [9] 67.86138 72.17351
> rowSums(tmp5,na.rm=TRUE)
 [1] 1860.026 1342.097 1387.894 1433.534 1331.953 1432.254 1345.905 1393.317
 [9] 1357.228 1443.470
> rowVars(tmp5,na.rm=TRUE)
 [1] 7973.70588   84.97966   60.45265   65.67122   78.44435   51.33352
 [7]   68.33091   95.13041  115.57664   87.89546
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.295610  9.218442  7.775130  8.103778  8.856882  7.164741  8.266251
 [8]  9.753482 10.750658  9.375258
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.07844  82.53697  80.36318  84.38586  85.31078  84.90003  83.18981
 [8]  93.73607  84.96264  93.69936
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.89289 53.64444 54.00593 56.42157 58.52720 60.01640 55.57809 58.12456
 [9] 52.49175 55.83121
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.06221  65.04626  71.46056  72.33829  70.85801  71.41338  66.57927
 [8]  70.11040  65.39421  72.60329  68.57863  77.75578  68.18260  64.48331
[15]  69.80795  65.81290  74.98186  68.84511  74.87772  71.23402
> colSums(tmp5,na.rm=TRUE)
 [1] 1090.6221  650.4626  714.6056  723.3829  708.5801  714.1338  599.2135
 [8]  701.1040  653.9421  726.0329  685.7863  777.5578  681.8260  644.8331
[15]  698.0795  658.1290  749.8186  688.4511  748.7772  712.3402
> colVars(tmp5,na.rm=TRUE)
 [1] 16152.27165    53.09698    84.12040   117.90366   112.63475    71.42248
 [7]    58.53477    42.02231    74.75638    51.16015    87.45507    57.73496
[13]   205.75235    53.74019    55.18961    68.08698    52.12929    42.48190
[19]    87.33647    81.72485
> colSd(tmp5,na.rm=TRUE)
 [1] 127.091588   7.286767   9.171717  10.858345  10.612952   8.451182
 [7]   7.650802   6.482462   8.646177   7.152632   9.351742   7.598352
[13]  14.344070   7.330770   7.428971   8.251484   7.220062   6.517814
[19]   9.345398   9.040180
> colMax(tmp5,na.rm=TRUE)
 [1] 470.07844  76.75436  85.63518  83.33599  84.99070  84.02401  74.69865
 [8]  77.26702  77.46549  82.64538  84.90003  86.90702  93.73607  77.69771
[15]  81.17744  78.48040  87.85235  80.74550  93.76177  85.31078
> colMin(tmp5,na.rm=TRUE)
 [1] 60.79898 53.89289 61.27352 55.57270 54.00593 58.12456 53.64444 55.10286
 [9] 53.92628 56.72447 55.25935 59.78232 55.57809 56.42157 58.07975 52.49175
[17] 67.35627 60.12767 62.17333 60.75003
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.00131 67.10483 69.39471 71.67669      NaN 71.61272 67.29527 69.66583
 [9] 67.86138 72.17351
> rowSums(tmp5,na.rm=TRUE)
 [1] 1860.026 1342.097 1387.894 1433.534    0.000 1432.254 1345.905 1393.317
 [9] 1357.228 1443.470
> rowVars(tmp5,na.rm=TRUE)
 [1] 7973.70588   84.97966   60.45265   65.67122         NA   51.33352
 [7]   68.33091   95.13041  115.57664   87.89546
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.295610  9.218442  7.775130  8.103778        NA  7.164741  8.266251
 [8]  9.753482 10.750658  9.375258
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.07844  82.53697  80.36318  84.38586        NA  84.90003  83.18981
 [8]  93.73607  84.96264  93.69936
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.89289 53.64444 54.00593 56.42157       NA 60.01640 55.57809 58.12456
 [9] 52.49175 55.83121
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.87034  64.92402  72.59245  71.89966  69.28771  72.57459       NaN
 [8]  70.17417  65.79889  72.12613  69.69546  79.75283  68.03632  64.90762
[15]  69.84123  65.31640  74.64815  68.24923  76.02505  69.66993
> colSums(tmp5,na.rm=TRUE)
 [1] 1006.8331  584.3161  653.3320  647.0970  623.5894  653.1714    0.0000
 [8]  631.5675  592.1900  649.1352  627.2592  717.7754  612.3268  584.1686
[15]  628.5710  587.8476  671.8333  614.2430  684.2254  627.0294
> colVars(tmp5,na.rm=TRUE)
 [1] 18082.59290    59.56597    80.22216   130.47717    98.97342    65.18051
 [7]          NA    47.22935    82.25852    54.99368    84.35482    20.08446
[13]   231.23066    58.43226    62.07585    73.82456    57.39262    43.79747
[19]    83.44461    64.41888
> colSd(tmp5,na.rm=TRUE)
 [1] 134.471532   7.717900   8.956682  11.422660   9.948538   8.073445
 [7]         NA   6.872361   9.069648   7.415772   9.184488   4.481569
[13]  15.206271   7.644100   7.878823   8.592122   7.575792   6.617966
[19]   9.134802   8.026138
> colMax(tmp5,na.rm=TRUE)
 [1] 470.07844  76.75436  85.63518  83.33599  80.45188  84.02401      -Inf
 [8]  77.26702  77.46549  82.64538  84.90003  86.90702  93.73607  77.69771
[15]  81.17744  78.48040  87.85235  80.74550  93.76177  83.18981
> colMin(tmp5,na.rm=TRUE)
 [1] 60.79898 53.89289 64.47929 55.57270 54.00593 58.12456      Inf 55.10286
 [9] 53.92628 56.72447 55.25935 73.53250 55.57809 56.42157 58.07975 52.49175
[17] 67.35627 60.12767 62.17333 60.75003
> 
> 
> 
> 
> 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] 254.2968 244.2712 154.8914 182.4508 179.1568 203.1208 202.7137 413.4386
 [9] 160.4476 266.6040
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 254.2968 244.2712 154.8914 182.4508 179.1568 203.1208 202.7137 413.4386
 [9] 160.4476 266.6040
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.989520e-13 -1.421085e-13  2.842171e-14 -1.705303e-13  5.684342e-14
 [6] -1.421085e-14  4.263256e-14  2.273737e-13 -1.705303e-13  2.842171e-14
[11]  2.273737e-13 -5.684342e-14  5.684342e-14  2.842171e-14 -2.842171e-14
[16] -5.684342e-14  5.684342e-14  1.136868e-13  0.000000e+00 -5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   17 
2   16 
1   5 
5   1 
8   19 
7   9 
8   18 
2   14 
9   4 
7   1 
6   7 
7   15 
3   1 
10   7 
2   4 
10   17 
10   19 
9   1 
5   8 
9   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.624644
> Min(tmp)
[1] -2.31551
> mean(tmp)
[1] -0.03076078
> Sum(tmp)
[1] -3.076078
> Var(tmp)
[1] 0.8974022
> 
> rowMeans(tmp)
[1] -0.03076078
> rowSums(tmp)
[1] -3.076078
> rowVars(tmp)
[1] 0.8974022
> rowSd(tmp)
[1] 0.9473131
> rowMax(tmp)
[1] 2.624644
> rowMin(tmp)
[1] -2.31551
> 
> colMeans(tmp)
  [1]  1.637868370 -0.541626986  0.355490234 -1.708876458  0.049669783
  [6] -0.260691812  0.902601757  0.632475782 -1.679695803  0.023996985
 [11] -0.013890015 -0.323422202 -0.374723721  0.763204102  1.220762022
 [16] -0.123260866  0.125396984  0.093871584 -0.407262728 -0.892912584
 [21] -0.832200707 -0.048271889 -1.160189865 -0.765380842  0.095243072
 [26]  1.143916802  1.022326240 -0.569499449 -0.395510891 -0.094985477
 [31]  0.389777685 -0.792232123  2.624644282 -0.044098747 -0.222390977
 [36] -0.651049933 -1.024211289  0.305551531  1.846266650 -0.948740324
 [41]  0.264799185  0.423243981  1.624999526  0.729205833 -0.020282484
 [46] -1.280083883 -0.275388988 -1.042862485 -0.763609139  2.122675158
 [51]  0.348103670 -0.031555655  1.306242140 -0.613094089 -1.341402874
 [56] -0.546076642 -0.077948199  1.500945303 -1.383198661  0.353390921
 [61]  0.876872374  1.227085967  0.852458537 -0.817246559 -0.428955090
 [66] -0.550385291 -1.703892944  0.866081952  0.636133282 -1.516776233
 [71]  0.765013561 -0.900673990 -0.855421644  0.237023610  0.066525581
 [76] -0.236496473 -0.337219167  0.541257585  1.046672888  0.463370671
 [81]  0.749862603  1.776029508 -0.609104262  0.513180538  0.044065887
 [86]  0.297150394  0.549553018  1.244857704 -0.364179171  0.007419048
 [91] -2.315509537 -0.685405008  1.427555566 -1.002852287 -1.472024662
 [96] -0.519003381 -0.832864446 -0.569045488 -1.750946051 -0.452287689
> colSums(tmp)
  [1]  1.637868370 -0.541626986  0.355490234 -1.708876458  0.049669783
  [6] -0.260691812  0.902601757  0.632475782 -1.679695803  0.023996985
 [11] -0.013890015 -0.323422202 -0.374723721  0.763204102  1.220762022
 [16] -0.123260866  0.125396984  0.093871584 -0.407262728 -0.892912584
 [21] -0.832200707 -0.048271889 -1.160189865 -0.765380842  0.095243072
 [26]  1.143916802  1.022326240 -0.569499449 -0.395510891 -0.094985477
 [31]  0.389777685 -0.792232123  2.624644282 -0.044098747 -0.222390977
 [36] -0.651049933 -1.024211289  0.305551531  1.846266650 -0.948740324
 [41]  0.264799185  0.423243981  1.624999526  0.729205833 -0.020282484
 [46] -1.280083883 -0.275388988 -1.042862485 -0.763609139  2.122675158
 [51]  0.348103670 -0.031555655  1.306242140 -0.613094089 -1.341402874
 [56] -0.546076642 -0.077948199  1.500945303 -1.383198661  0.353390921
 [61]  0.876872374  1.227085967  0.852458537 -0.817246559 -0.428955090
 [66] -0.550385291 -1.703892944  0.866081952  0.636133282 -1.516776233
 [71]  0.765013561 -0.900673990 -0.855421644  0.237023610  0.066525581
 [76] -0.236496473 -0.337219167  0.541257585  1.046672888  0.463370671
 [81]  0.749862603  1.776029508 -0.609104262  0.513180538  0.044065887
 [86]  0.297150394  0.549553018  1.244857704 -0.364179171  0.007419048
 [91] -2.315509537 -0.685405008  1.427555566 -1.002852287 -1.472024662
 [96] -0.519003381 -0.832864446 -0.569045488 -1.750946051 -0.452287689
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.637868370 -0.541626986  0.355490234 -1.708876458  0.049669783
  [6] -0.260691812  0.902601757  0.632475782 -1.679695803  0.023996985
 [11] -0.013890015 -0.323422202 -0.374723721  0.763204102  1.220762022
 [16] -0.123260866  0.125396984  0.093871584 -0.407262728 -0.892912584
 [21] -0.832200707 -0.048271889 -1.160189865 -0.765380842  0.095243072
 [26]  1.143916802  1.022326240 -0.569499449 -0.395510891 -0.094985477
 [31]  0.389777685 -0.792232123  2.624644282 -0.044098747 -0.222390977
 [36] -0.651049933 -1.024211289  0.305551531  1.846266650 -0.948740324
 [41]  0.264799185  0.423243981  1.624999526  0.729205833 -0.020282484
 [46] -1.280083883 -0.275388988 -1.042862485 -0.763609139  2.122675158
 [51]  0.348103670 -0.031555655  1.306242140 -0.613094089 -1.341402874
 [56] -0.546076642 -0.077948199  1.500945303 -1.383198661  0.353390921
 [61]  0.876872374  1.227085967  0.852458537 -0.817246559 -0.428955090
 [66] -0.550385291 -1.703892944  0.866081952  0.636133282 -1.516776233
 [71]  0.765013561 -0.900673990 -0.855421644  0.237023610  0.066525581
 [76] -0.236496473 -0.337219167  0.541257585  1.046672888  0.463370671
 [81]  0.749862603  1.776029508 -0.609104262  0.513180538  0.044065887
 [86]  0.297150394  0.549553018  1.244857704 -0.364179171  0.007419048
 [91] -2.315509537 -0.685405008  1.427555566 -1.002852287 -1.472024662
 [96] -0.519003381 -0.832864446 -0.569045488 -1.750946051 -0.452287689
> colMin(tmp)
  [1]  1.637868370 -0.541626986  0.355490234 -1.708876458  0.049669783
  [6] -0.260691812  0.902601757  0.632475782 -1.679695803  0.023996985
 [11] -0.013890015 -0.323422202 -0.374723721  0.763204102  1.220762022
 [16] -0.123260866  0.125396984  0.093871584 -0.407262728 -0.892912584
 [21] -0.832200707 -0.048271889 -1.160189865 -0.765380842  0.095243072
 [26]  1.143916802  1.022326240 -0.569499449 -0.395510891 -0.094985477
 [31]  0.389777685 -0.792232123  2.624644282 -0.044098747 -0.222390977
 [36] -0.651049933 -1.024211289  0.305551531  1.846266650 -0.948740324
 [41]  0.264799185  0.423243981  1.624999526  0.729205833 -0.020282484
 [46] -1.280083883 -0.275388988 -1.042862485 -0.763609139  2.122675158
 [51]  0.348103670 -0.031555655  1.306242140 -0.613094089 -1.341402874
 [56] -0.546076642 -0.077948199  1.500945303 -1.383198661  0.353390921
 [61]  0.876872374  1.227085967  0.852458537 -0.817246559 -0.428955090
 [66] -0.550385291 -1.703892944  0.866081952  0.636133282 -1.516776233
 [71]  0.765013561 -0.900673990 -0.855421644  0.237023610  0.066525581
 [76] -0.236496473 -0.337219167  0.541257585  1.046672888  0.463370671
 [81]  0.749862603  1.776029508 -0.609104262  0.513180538  0.044065887
 [86]  0.297150394  0.549553018  1.244857704 -0.364179171  0.007419048
 [91] -2.315509537 -0.685405008  1.427555566 -1.002852287 -1.472024662
 [96] -0.519003381 -0.832864446 -0.569045488 -1.750946051 -0.452287689
> colMedians(tmp)
  [1]  1.637868370 -0.541626986  0.355490234 -1.708876458  0.049669783
  [6] -0.260691812  0.902601757  0.632475782 -1.679695803  0.023996985
 [11] -0.013890015 -0.323422202 -0.374723721  0.763204102  1.220762022
 [16] -0.123260866  0.125396984  0.093871584 -0.407262728 -0.892912584
 [21] -0.832200707 -0.048271889 -1.160189865 -0.765380842  0.095243072
 [26]  1.143916802  1.022326240 -0.569499449 -0.395510891 -0.094985477
 [31]  0.389777685 -0.792232123  2.624644282 -0.044098747 -0.222390977
 [36] -0.651049933 -1.024211289  0.305551531  1.846266650 -0.948740324
 [41]  0.264799185  0.423243981  1.624999526  0.729205833 -0.020282484
 [46] -1.280083883 -0.275388988 -1.042862485 -0.763609139  2.122675158
 [51]  0.348103670 -0.031555655  1.306242140 -0.613094089 -1.341402874
 [56] -0.546076642 -0.077948199  1.500945303 -1.383198661  0.353390921
 [61]  0.876872374  1.227085967  0.852458537 -0.817246559 -0.428955090
 [66] -0.550385291 -1.703892944  0.866081952  0.636133282 -1.516776233
 [71]  0.765013561 -0.900673990 -0.855421644  0.237023610  0.066525581
 [76] -0.236496473 -0.337219167  0.541257585  1.046672888  0.463370671
 [81]  0.749862603  1.776029508 -0.609104262  0.513180538  0.044065887
 [86]  0.297150394  0.549553018  1.244857704 -0.364179171  0.007419048
 [91] -2.315509537 -0.685405008  1.427555566 -1.002852287 -1.472024662
 [96] -0.519003381 -0.832864446 -0.569045488 -1.750946051 -0.452287689
> colRanges(tmp)
         [,1]      [,2]      [,3]      [,4]       [,5]       [,6]      [,7]
[1,] 1.637868 -0.541627 0.3554902 -1.708876 0.04966978 -0.2606918 0.9026018
[2,] 1.637868 -0.541627 0.3554902 -1.708876 0.04966978 -0.2606918 0.9026018
          [,8]      [,9]      [,10]       [,11]      [,12]      [,13]     [,14]
[1,] 0.6324758 -1.679696 0.02399698 -0.01389001 -0.3234222 -0.3747237 0.7632041
[2,] 0.6324758 -1.679696 0.02399698 -0.01389001 -0.3234222 -0.3747237 0.7632041
        [,15]      [,16]    [,17]      [,18]      [,19]      [,20]      [,21]
[1,] 1.220762 -0.1232609 0.125397 0.09387158 -0.4072627 -0.8929126 -0.8322007
[2,] 1.220762 -0.1232609 0.125397 0.09387158 -0.4072627 -0.8929126 -0.8322007
           [,22]    [,23]      [,24]      [,25]    [,26]    [,27]      [,28]
[1,] -0.04827189 -1.16019 -0.7653808 0.09524307 1.143917 1.022326 -0.5694994
[2,] -0.04827189 -1.16019 -0.7653808 0.09524307 1.143917 1.022326 -0.5694994
          [,29]       [,30]     [,31]      [,32]    [,33]       [,34]     [,35]
[1,] -0.3955109 -0.09498548 0.3897777 -0.7922321 2.624644 -0.04409875 -0.222391
[2,] -0.3955109 -0.09498548 0.3897777 -0.7922321 2.624644 -0.04409875 -0.222391
          [,36]     [,37]     [,38]    [,39]      [,40]     [,41]    [,42]
[1,] -0.6510499 -1.024211 0.3055515 1.846267 -0.9487403 0.2647992 0.423244
[2,] -0.6510499 -1.024211 0.3055515 1.846267 -0.9487403 0.2647992 0.423244
     [,43]     [,44]       [,45]     [,46]     [,47]     [,48]      [,49]
[1,] 1.625 0.7292058 -0.02028248 -1.280084 -0.275389 -1.042862 -0.7636091
[2,] 1.625 0.7292058 -0.02028248 -1.280084 -0.275389 -1.042862 -0.7636091
        [,50]     [,51]       [,52]    [,53]      [,54]     [,55]      [,56]
[1,] 2.122675 0.3481037 -0.03155565 1.306242 -0.6130941 -1.341403 -0.5460766
[2,] 2.122675 0.3481037 -0.03155565 1.306242 -0.6130941 -1.341403 -0.5460766
          [,57]    [,58]     [,59]     [,60]     [,61]    [,62]     [,63]
[1,] -0.0779482 1.500945 -1.383199 0.3533909 0.8768724 1.227086 0.8524585
[2,] -0.0779482 1.500945 -1.383199 0.3533909 0.8768724 1.227086 0.8524585
          [,64]      [,65]      [,66]     [,67]    [,68]     [,69]     [,70]
[1,] -0.8172466 -0.4289551 -0.5503853 -1.703893 0.866082 0.6361333 -1.516776
[2,] -0.8172466 -0.4289551 -0.5503853 -1.703893 0.866082 0.6361333 -1.516776
         [,71]     [,72]      [,73]     [,74]      [,75]      [,76]      [,77]
[1,] 0.7650136 -0.900674 -0.8554216 0.2370236 0.06652558 -0.2364965 -0.3372192
[2,] 0.7650136 -0.900674 -0.8554216 0.2370236 0.06652558 -0.2364965 -0.3372192
         [,78]    [,79]     [,80]     [,81]   [,82]      [,83]     [,84]
[1,] 0.5412576 1.046673 0.4633707 0.7498626 1.77603 -0.6091043 0.5131805
[2,] 0.5412576 1.046673 0.4633707 0.7498626 1.77603 -0.6091043 0.5131805
          [,85]     [,86]    [,87]    [,88]      [,89]       [,90]    [,91]
[1,] 0.04406589 0.2971504 0.549553 1.244858 -0.3641792 0.007419048 -2.31551
[2,] 0.04406589 0.2971504 0.549553 1.244858 -0.3641792 0.007419048 -2.31551
         [,92]    [,93]     [,94]     [,95]      [,96]      [,97]      [,98]
[1,] -0.685405 1.427556 -1.002852 -1.472025 -0.5190034 -0.8328644 -0.5690455
[2,] -0.685405 1.427556 -1.002852 -1.472025 -0.5190034 -0.8328644 -0.5690455
         [,99]     [,100]
[1,] -1.750946 -0.4522877
[2,] -1.750946 -0.4522877
> 
> 
> Max(tmp2)
[1] 1.966967
> Min(tmp2)
[1] -1.810455
> mean(tmp2)
[1] 0.08184211
> Sum(tmp2)
[1] 8.184211
> Var(tmp2)
[1] 0.7526563
> 
> rowMeans(tmp2)
  [1] -0.4784277899  0.6414072888  0.1440241944 -0.7846932783 -0.2886033948
  [6]  0.5053085891 -1.0957740518  0.2743228411  1.1239676193  0.2680134501
 [11] -1.4198920561 -0.6683562932  0.2420772159 -1.3230852521 -1.1997335551
 [16]  0.0961478884 -0.8414840935 -0.0599134272  0.0077795395  1.5825996576
 [21]  0.4397914793 -0.6851678927 -0.3066259955  1.1016501071  0.1188690499
 [26] -0.0793855323  0.3015107098  0.7833375028 -1.1577066422  1.9669671551
 [31] -1.5050626595  0.4368821093  0.1366886251  1.3878866836  0.6763329795
 [36] -0.4818971552  1.2642450899  0.8608530351  1.2044770787 -0.0756424540
 [41]  0.6426382258 -0.5800382695 -0.1958998131 -0.6806012631  0.3863614489
 [46]  1.7651346802 -0.4662178548  0.5972653564  1.1616806239  1.4744264712
 [51] -1.6151792015 -1.3418731525 -0.6030506293 -0.2304845826  1.1062752058
 [56]  0.2816270174 -0.7203674792  1.2552418208  0.2705452152  0.1016747814
 [61] -1.0634885483  1.5212473032 -0.0132103681  0.8552682766 -1.5512887400
 [66] -0.0351287893 -1.0820198306 -0.0088388391 -0.1303649953 -0.0533891192
 [71]  0.7583781060  0.1817561883  0.5503007001  0.2405575458 -1.0435900924
 [76]  0.8850717323  0.3478224937  0.7647033146  1.7238382571  0.2277351349
 [81]  1.0544306096 -0.0003597311 -0.8514267053 -1.0674225933  0.8830452903
 [86]  0.9213129211  1.2255281424 -1.1438583803 -0.6981921510 -0.3018053037
 [91] -0.9563280609 -1.8104549216  0.4862321557  0.0961041007  0.4161762192
 [96] -0.0299114842  0.2347941714  1.0919871387 -0.2994407743  0.1355939440
> rowSums(tmp2)
  [1] -0.4784277899  0.6414072888  0.1440241944 -0.7846932783 -0.2886033948
  [6]  0.5053085891 -1.0957740518  0.2743228411  1.1239676193  0.2680134501
 [11] -1.4198920561 -0.6683562932  0.2420772159 -1.3230852521 -1.1997335551
 [16]  0.0961478884 -0.8414840935 -0.0599134272  0.0077795395  1.5825996576
 [21]  0.4397914793 -0.6851678927 -0.3066259955  1.1016501071  0.1188690499
 [26] -0.0793855323  0.3015107098  0.7833375028 -1.1577066422  1.9669671551
 [31] -1.5050626595  0.4368821093  0.1366886251  1.3878866836  0.6763329795
 [36] -0.4818971552  1.2642450899  0.8608530351  1.2044770787 -0.0756424540
 [41]  0.6426382258 -0.5800382695 -0.1958998131 -0.6806012631  0.3863614489
 [46]  1.7651346802 -0.4662178548  0.5972653564  1.1616806239  1.4744264712
 [51] -1.6151792015 -1.3418731525 -0.6030506293 -0.2304845826  1.1062752058
 [56]  0.2816270174 -0.7203674792  1.2552418208  0.2705452152  0.1016747814
 [61] -1.0634885483  1.5212473032 -0.0132103681  0.8552682766 -1.5512887400
 [66] -0.0351287893 -1.0820198306 -0.0088388391 -0.1303649953 -0.0533891192
 [71]  0.7583781060  0.1817561883  0.5503007001  0.2405575458 -1.0435900924
 [76]  0.8850717323  0.3478224937  0.7647033146  1.7238382571  0.2277351349
 [81]  1.0544306096 -0.0003597311 -0.8514267053 -1.0674225933  0.8830452903
 [86]  0.9213129211  1.2255281424 -1.1438583803 -0.6981921510 -0.3018053037
 [91] -0.9563280609 -1.8104549216  0.4862321557  0.0961041007  0.4161762192
 [96] -0.0299114842  0.2347941714  1.0919871387 -0.2994407743  0.1355939440
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.4784277899  0.6414072888  0.1440241944 -0.7846932783 -0.2886033948
  [6]  0.5053085891 -1.0957740518  0.2743228411  1.1239676193  0.2680134501
 [11] -1.4198920561 -0.6683562932  0.2420772159 -1.3230852521 -1.1997335551
 [16]  0.0961478884 -0.8414840935 -0.0599134272  0.0077795395  1.5825996576
 [21]  0.4397914793 -0.6851678927 -0.3066259955  1.1016501071  0.1188690499
 [26] -0.0793855323  0.3015107098  0.7833375028 -1.1577066422  1.9669671551
 [31] -1.5050626595  0.4368821093  0.1366886251  1.3878866836  0.6763329795
 [36] -0.4818971552  1.2642450899  0.8608530351  1.2044770787 -0.0756424540
 [41]  0.6426382258 -0.5800382695 -0.1958998131 -0.6806012631  0.3863614489
 [46]  1.7651346802 -0.4662178548  0.5972653564  1.1616806239  1.4744264712
 [51] -1.6151792015 -1.3418731525 -0.6030506293 -0.2304845826  1.1062752058
 [56]  0.2816270174 -0.7203674792  1.2552418208  0.2705452152  0.1016747814
 [61] -1.0634885483  1.5212473032 -0.0132103681  0.8552682766 -1.5512887400
 [66] -0.0351287893 -1.0820198306 -0.0088388391 -0.1303649953 -0.0533891192
 [71]  0.7583781060  0.1817561883  0.5503007001  0.2405575458 -1.0435900924
 [76]  0.8850717323  0.3478224937  0.7647033146  1.7238382571  0.2277351349
 [81]  1.0544306096 -0.0003597311 -0.8514267053 -1.0674225933  0.8830452903
 [86]  0.9213129211  1.2255281424 -1.1438583803 -0.6981921510 -0.3018053037
 [91] -0.9563280609 -1.8104549216  0.4862321557  0.0961041007  0.4161762192
 [96] -0.0299114842  0.2347941714  1.0919871387 -0.2994407743  0.1355939440
> rowMin(tmp2)
  [1] -0.4784277899  0.6414072888  0.1440241944 -0.7846932783 -0.2886033948
  [6]  0.5053085891 -1.0957740518  0.2743228411  1.1239676193  0.2680134501
 [11] -1.4198920561 -0.6683562932  0.2420772159 -1.3230852521 -1.1997335551
 [16]  0.0961478884 -0.8414840935 -0.0599134272  0.0077795395  1.5825996576
 [21]  0.4397914793 -0.6851678927 -0.3066259955  1.1016501071  0.1188690499
 [26] -0.0793855323  0.3015107098  0.7833375028 -1.1577066422  1.9669671551
 [31] -1.5050626595  0.4368821093  0.1366886251  1.3878866836  0.6763329795
 [36] -0.4818971552  1.2642450899  0.8608530351  1.2044770787 -0.0756424540
 [41]  0.6426382258 -0.5800382695 -0.1958998131 -0.6806012631  0.3863614489
 [46]  1.7651346802 -0.4662178548  0.5972653564  1.1616806239  1.4744264712
 [51] -1.6151792015 -1.3418731525 -0.6030506293 -0.2304845826  1.1062752058
 [56]  0.2816270174 -0.7203674792  1.2552418208  0.2705452152  0.1016747814
 [61] -1.0634885483  1.5212473032 -0.0132103681  0.8552682766 -1.5512887400
 [66] -0.0351287893 -1.0820198306 -0.0088388391 -0.1303649953 -0.0533891192
 [71]  0.7583781060  0.1817561883  0.5503007001  0.2405575458 -1.0435900924
 [76]  0.8850717323  0.3478224937  0.7647033146  1.7238382571  0.2277351349
 [81]  1.0544306096 -0.0003597311 -0.8514267053 -1.0674225933  0.8830452903
 [86]  0.9213129211  1.2255281424 -1.1438583803 -0.6981921510 -0.3018053037
 [91] -0.9563280609 -1.8104549216  0.4862321557  0.0961041007  0.4161762192
 [96] -0.0299114842  0.2347941714  1.0919871387 -0.2994407743  0.1355939440
> 
> colMeans(tmp2)
[1] 0.08184211
> colSums(tmp2)
[1] 8.184211
> colVars(tmp2)
[1] 0.7526563
> colSd(tmp2)
[1] 0.8675577
> colMax(tmp2)
[1] 1.966967
> colMin(tmp2)
[1] -1.810455
> colMedians(tmp2)
[1] 0.1272315
> colRanges(tmp2)
          [,1]
[1,] -1.810455
[2,]  1.966967
> 
> 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]  4.029481  1.085038  3.531093  1.366920  2.782048 -2.263836  1.926218
 [8] -2.132289 -1.286858  4.274917
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.68538519
[2,]  0.05551401
[3,]  0.50329037
[4,]  0.71398949
[5,]  1.41463377
> 
> rowApply(tmp,sum)
 [1]  0.139486  4.673917 -2.418531 -1.856966  4.879802 -1.445354  2.430085
 [8]  2.371739  1.799465  2.739088
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8   10    5    9    6   10    4    3    6     7
 [2,]    2    8    8    2    3    5    3    8    9     2
 [3,]    6    2    9    5    8    9    8    9    4     5
 [4,]    5    3    2    4    7    8    7    5    3    10
 [5,]    4    5    3    6   10    7    5    4    7     9
 [6,]    1    7    7    8    1    1    1    6    1     8
 [7,]    9    1    4   10    4    4    6   10    8     3
 [8,]    7    6    6    7    5    3    2    1    2     1
 [9,]   10    9    1    1    2    6    9    2   10     4
[10,]    3    4   10    3    9    2   10    7    5     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.22880706  0.55966571  4.44359935  0.79103569 -1.87165788 -1.79925200
 [7]  5.15894661  0.77013555  2.13104504 -2.48044228  2.51218840  1.81853019
[13] -1.64601939 -1.24415002 -3.59707692  3.17471185  0.07402467 -3.08274233
[19] -1.84497932 -0.10849026
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.4352792
[2,]  0.1654373
[3,]  0.2077752
[4,]  0.8846856
[5,]  1.4061882
> 
> rowApply(tmp,sum)
[1]  4.798935 -1.061823  5.822083 -4.958697  1.387381
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10   17   16    7    9
[2,]    9   10   14    6   14
[3,]    1   19   17   19   20
[4,]   20    8    6   17    8
[5,]    4    3    9    8   12
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]        [,4]        [,5]       [,6]
[1,]  0.1654373  0.10862041 -0.9366047  1.46104327 -0.44892119  0.8901673
[2,]  1.4061882 -0.06673786  1.5063017 -0.71044235 -1.59801505  0.3409578
[3,]  0.8846856  0.64666555  0.9722804 -0.18261783  0.07551059 -0.2533713
[4,] -0.4352792 -0.75202294  1.6053204  0.30719143 -0.42730426 -1.9025167
[5,]  0.2077752  0.62314054  1.2963016 -0.08413883  0.52707203 -0.8744891
          [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
[1,] 1.1892507  0.7770780  0.20923609  0.3038675  0.3459209 -0.2694756
[2,] 0.2610321 -0.9974445  1.03255706 -1.6099982  1.3244168  1.4669257
[3,] 1.3109756  0.5417130  0.18263497 -0.1799031  0.8617485  1.0148553
[4,] 1.6652031 -0.1275254 -0.02860509 -0.1155574 -0.9782942 -1.5555257
[5,] 0.7324851  0.5763145  0.73522202 -0.8788511  0.9583964  1.1617505
            [,13]       [,14]      [,15]      [,16]       [,17]      [,18]
[1,]  0.893691520 -0.26033217 -0.2627701  1.3453651  0.06359612 -0.7459916
[2,] -1.610899460  0.04549572 -1.2904469 -0.3484978  1.89746373  0.5342410
[3,]  0.008631458 -1.20959385 -0.3111543  0.4107368  0.27305437 -0.5090518
[4,]  0.186385942 -0.14143933  0.1087215  1.3483604 -1.34916839 -2.0491688
[5,] -1.123828852  0.32171961 -1.8414271  0.4187473 -0.81092116 -0.3127710
          [,19]       [,20]
[1,] -0.4817297  0.45148558
[2,] -1.4290638 -1.21585686
[3,] -0.6132884  1.89757173
[4,] -0.2292767 -0.08819519
[5,]  0.9083792 -1.15349553
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  560  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1     col2       col3       col4     col5       col6       col7
row1 -1.030283 -0.33207 -0.6751216 -0.7100105 1.826782 -0.4412567 -0.9194669
          col8      col9      col10    col11     col12     col13    col14
row1 0.5459671 0.6517422 -0.1951442 1.150219 0.2499366 0.3952631 1.207441
        col15     col16     col17     col18    col19      col20
row1 2.758106 0.2827302 0.1905229 0.7856886 0.323126 -0.3253055
> tmp[,"col10"]
          col10
row1 -0.1951442
row2 -0.6931673
row3  0.2304365
row4 -1.9441383
row5 -0.7683427
> tmp[c("row1","row5"),]
           col1      col2       col3       col4      col5       col6
row1 -1.0302835 -0.332070 -0.6751216 -0.7100105 1.8267819 -0.4412567
row5 -0.8239855 -1.512074 -0.1028689 -0.8868086 0.5156394  1.0192968
            col7       col8       col9      col10      col11     col12
row1 -0.91946694  0.5459671  0.6517422 -0.1951442 1.15021888 0.2499366
row5 -0.04828676 -0.6029756 -0.4509653 -0.7683427 0.09797459 0.6384614
          col13      col14    col15      col16     col17     col18     col19
row1  0.3952631  1.2074409 2.758106 0.28273019 0.1905229 0.7856886  0.323126
row5 -1.2940650 -0.9255508 2.694999 0.02933813 1.1062745 1.0233727 -1.149833
          col20
row1 -0.3253055
row5  0.1195127
> tmp[,c("col6","col20")]
             col6      col20
row1 -0.441256725 -0.3253055
row2 -0.257616810 -0.5066515
row3 -0.007609483 -0.5570180
row4  1.312163307  1.7812945
row5  1.019296816  0.1195127
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.4412567 -0.3253055
row5  1.0192968  0.1195127
> 
> 
> 
> 
> 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 51.14317 51.43191 50.4284 49.90725 49.93696 104.4215 50.3234 50.00229
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52277 50.83579 50.90054 49.54469 49.68644 49.46035 51.14918 49.64061
        col17    col18    col19    col20
row1 51.55798 49.06477 49.87438 105.3783
> tmp[,"col10"]
        col10
row1 50.83579
row2 31.17328
row3 30.37974
row4 29.77272
row5 51.30029
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.14317 51.43191 50.42840 49.90725 49.93696 104.4215 50.32340 50.00229
row5 49.13576 50.23764 50.03861 51.08389 49.50783 104.9473 48.31857 49.63454
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52277 50.83579 50.90054 49.54469 49.68644 49.46035 51.14918 49.64061
row5 49.06528 51.30029 50.06736 50.59562 50.23094 49.45387 50.98393 48.79806
        col17    col18    col19    col20
row1 51.55798 49.06477 49.87438 105.3783
row5 51.35544 50.80431 49.86479 107.1838
> tmp[,c("col6","col20")]
          col6     col20
row1 104.42146 105.37831
row2  73.69028  75.53163
row3  75.77804  73.99017
row4  73.81116  76.24740
row5 104.94731 107.18381
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.4215 105.3783
row5 104.9473 107.1838
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.4215 105.3783
row5 104.9473 107.1838
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -1.50553003
[2,] -1.35164071
[3,]  1.67343037
[4,] -1.24962680
[5,] -0.09751052
> tmp[,c("col17","col7")]
           col17        col7
[1,] -1.66733256 -0.32833707
[2,] -0.75587886  1.16877865
[3,]  0.98523846 -0.08804664
[4,]  0.09396199  1.25809034
[5,]  0.03144245 -1.21726311
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
             col6      col20
[1,]  0.930898014 -0.5280996
[2,] -0.006373652  1.4321781
[3,]  1.328756439  1.0745586
[4,]  0.283839737 -0.5768943
[5,]  1.146430942  0.1632364
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 0.930898
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
             col6
[1,]  0.930898014
[2,] -0.006373652
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]       [,5]       [,6]
row3 -0.2812189 -1.1657596 0.3985245  0.5445602 1.04461351 -0.1522232
row1 -1.7744512 -0.2549487 1.4091925 -0.8497186 0.09947928 -1.3533168
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
row3 -0.7015788  0.4780601 -0.4815662  1.0558472 -0.3690466 -0.2448079
row1  0.2935191 -0.8072524 -0.3371549 -0.6124422  0.7641898 -0.4475296
         [,13]       [,14]      [,15]       [,16]     [,17]     [,18]
row3 0.6559485 -0.29664565 -0.3183640 -0.01189204 0.8341530 0.4069952
row1 1.9174702 -0.04071218  0.1192868 -0.46633155 0.4252082 0.4209761
           [,19]      [,20]
row3 -0.57213539  0.8512991
row1  0.01163503 -0.3092234
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]       [,3]      [,4]       [,5]      [,6]      [,7]
row2 -0.3464354 -1.241594 -0.7954184 -1.570864 -0.5427588 0.1139848 -1.150554
          [,8]      [,9]     [,10]
row2 0.3513944 0.1464239 -1.380685
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]     [,2]      [,3]     [,4]      [,5]       [,6]      [,7]
row5 0.08913083 2.548265 0.2733536 1.964726 0.1149463 -0.3724222 0.1322833
        [,8]       [,9]      [,10]      [,11]      [,12]       [,13]     [,14]
row5 1.32085 -0.2438191 -0.4924829 -0.1522848 -0.9401223 -0.00859365 0.0667426
          [,15]     [,16]    [,17]      [,18]     [,19]    [,20]
row5 -0.2130262 0.6777938 0.520516 -0.4281318 0.4227303 2.249048
> 
> 
> 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: 0x170b47b0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a63784865a"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a63bd6599" 
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a66a0273e" 
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a651c2d9f" 
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a64749f24d"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a663b7455" 
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a66d765fff"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a615d28816"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a67efab7e0"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a6231038e" 
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a647a8f08a"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a665b18698"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a65ef08222"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a6610f5efc"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM339a63cca85a2"
> 
> 
> ### 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: 0x18575bd0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x18575bd0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x18575bd0>
> rowMedians(tmp)
  [1] -0.4696922799  0.3068245928  0.3566081903  0.0452257381  0.2710947770
  [6] -0.3314893469 -0.2886445930  0.1250693116 -0.1712941633 -0.3616031949
 [11]  0.2339108415 -0.2788100623 -0.0546158708 -0.2759794515  0.3952436395
 [16] -0.6763133918  0.2447096631 -0.3696392523 -0.1213908588  0.2166202680
 [21] -0.2811662213  0.4584839808 -0.1408656859  0.3242359636 -0.1409604833
 [26] -0.1973991916  0.2170313207  0.0883171296  0.1701938235 -0.1825849380
 [31]  0.1728433341 -0.3213473460 -0.1014018372  0.3348654905  0.0662861088
 [36] -0.0148229942  0.2338717343  0.7665599625 -0.0190754221 -0.6609005812
 [41] -0.2214364656  0.4903197799 -0.1409538784 -0.0880730139  0.2839067881
 [46]  0.2181795109  0.4493361528 -0.0628173454 -0.0220444016  0.8789097177
 [51] -0.4238266530 -0.6620890691  0.0411552648 -0.1405096530  0.6774758778
 [56] -0.3516136716  0.1835502800  0.1710447847 -0.4633379828 -0.1939924239
 [61]  0.0156304193  0.0293859526 -0.0473220437  0.9302692596  0.6944274156
 [66]  0.3655751443  0.1008830253 -0.6649815526  0.7058346855  0.4857433021
 [71] -0.5699689453 -0.2786843448 -0.2544130725  0.2741230297 -0.1333448814
 [76] -0.1401801521 -0.1221405939  0.0214341337  0.0009141894 -0.3247965838
 [81]  0.0122442228  0.4341576020  0.0248540366 -0.4763853688 -0.3379929887
 [86]  0.4987210548 -0.2402619983  0.3103912411  0.0686056514  0.0357668963
 [91]  0.1170256011  0.0551520443  0.2705969779 -0.1014410167 -0.0152160868
 [96] -0.0779388460  0.7891251292  0.0750683517  0.2850928028 -0.3646989183
[101]  0.4306243632 -0.0335467862 -0.1309303074 -0.4009242735 -0.5119665967
[106]  0.3004642428  0.4569489490  0.2206454232 -0.1689836397 -0.2209597992
[111] -0.2332947113  0.6222182637  0.2185088157  0.1728943415  0.2104768303
[116]  0.2093164314  0.3940047820  0.5449212875 -0.1865846948  0.6103040434
[121] -0.2813552277  0.3317591163  0.2035457309  0.2897547030  0.6260241307
[126] -0.0464069369 -0.2024269629  0.2975110175  0.2207372676 -0.1106264216
[131]  0.2367989294  0.2414164115  0.1832689942 -0.1866467466  0.1093688470
[136]  0.1566595457  0.0977506933  0.2708666033  0.3083250609 -0.0436344390
[141] -0.3691716271  0.1715111793 -0.3426781034  0.0804303579  0.5905431043
[146]  0.5642630609 -0.2801431767  0.2860188710 -0.0010832924  0.0243739624
[151]  0.2470363200  0.0906303458 -0.3183403753  0.2519369978 -0.3689041688
[156] -0.1843816425  0.0289508518  0.4740589498  0.4064728753  0.1317639164
[161]  0.2552946661  0.0853205812 -0.5602869916 -0.3433664658  0.3387880564
[166] -0.1462162429  0.2467669893 -0.2108427213 -0.2088412812  0.6248990564
[171] -0.0657343085 -0.0456604208 -0.4705597695  0.2181629225 -0.4186381399
[176] -0.0382323829 -0.0988005202  0.1784215315 -0.0046613405 -0.2527055942
[181] -0.4671199341 -0.0190320415  0.3948387309  0.0992044766 -0.2883578157
[186] -0.0013642956 -0.0864082251 -0.4435586962  0.1378587160 -0.1061607159
[191] -0.7162200034  0.1234349505  0.5386174209 -0.1260075195  0.3307367170
[196] -0.4760887575 -0.6510250127  0.3936307804  0.5837434107 -0.0748182102
[201]  0.1231264544  0.4259159641 -0.0742624374  0.1619670489 -0.2915375886
[206]  0.3965788725 -0.0898976263  0.2645740625 -0.4133091672  0.4180566183
[211]  0.1505584267  0.2497669087  0.0219169896 -0.3408458192 -0.2893865899
[216]  0.0979572771  0.0187522248  0.1550952042 -0.0874765544 -0.5703847092
[221] -0.0656556364 -0.0588767241 -0.4932341780 -0.2995142865  0.4932804714
[226] -0.3119004305 -0.2423862392 -0.4660401245 -0.3538920020  0.1785590686
> 
> proc.time()
   user  system elapsed 
  1.918   0.822   2.765 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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: 0x24159ff0>
> .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: 0x24159ff0>
> .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: 0x24159ff0>
> .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: 0x24159ff0>
> 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: 0x2403f0e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2403f0e0>
> .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: 0x2403f0e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2403f0e0>
> .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: 0x2403f0e0>
> 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: 0x22fc6520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x22fc6520>
> .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: 0x22fc6520>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x22fc6520>
> .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: 0x22fc6520>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x22fc6520>
> .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: 0x22fc6520>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x22fc6520>
> .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: 0x22fc6520>
> 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: 0x229ca720>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x229ca720>
> .Call("R_bm_AddColumn",P)
<pointer: 0x229ca720>
> .Call("R_bm_AddColumn",P)
<pointer: 0x229ca720>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile33a125c6212e3" "BufferedMatrixFile33a12d378d18" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile33a125c6212e3" "BufferedMatrixFile33a12d378d18" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x238ba7d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x238ba7d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x238ba7d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x238ba7d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x238ba7d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x238ba7d0>
> .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: 0x239c1c90>
> .Call("R_bm_AddColumn",P)
<pointer: 0x239c1c90>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x239c1c90>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x239c1c90>
> 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: 0x24c6a110>
> .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: 0x24c6a110>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.314   0.046   0.345 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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.306   0.063   0.354 

Example timings