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

This page was generated on 2025-01-29 11:45 -0500 (Wed, 29 Jan 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.1 LTS)x86_64R Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences" 4661
palomino7Windows Server 2022 Datacenterx64R Under development (unstable) (2025-01-21 r87610 ucrt) -- "Unsuffered Consequences" 4457
lconwaymacOS 12.7.1 Montereyx86_64R Under development (unstable) (2025-01-22 r87618) -- "Unsuffered Consequences" 4468
kjohnson3macOS 13.7.1 Venturaarm64R Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences" 4421
kunpeng2Linux (openEuler 22.03 LTS-SP1)aarch64R Under development (unstable) (2024-11-24 r87369) -- "Unsuffered Consequences" 4411
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 246/2286HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.71.1  (landing page)
Ben Bolstad
Snapshot Date: 2025-01-28 13:40 -0500 (Tue, 28 Jan 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: 824836d
git_last_commit_date: 2024-12-14 17:47:34 -0500 (Sat, 14 Dec 2024)
nebbiolo1Linux (Ubuntu 24.04.1 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino7Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.7.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.1 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kunpeng2Linux (openEuler 22.03 LTS-SP1) / aarch64  OK    OK    NA  


CHECK results for BufferedMatrix on kjohnson3

To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.71.1
Command: /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.71.1.tar.gz
StartedAt: 2025-01-28 18:17:05 -0500 (Tue, 28 Jan 2025)
EndedAt: 2025-01-28 18:17:21 -0500 (Tue, 28 Jan 2025)
EllapsedTime: 16.2 seconds
RetCode: 0
Status:   WARNINGS  
CheckDir: BufferedMatrix.Rcheck
Warnings: 1

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.71.1.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2025-01-20 r87609)
* using platform: aarch64-apple-darwin20
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    GNU Fortran (GCC) 14.2.0
* running under: macOS Ventura 13.7.1
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.71.1’
* 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 ... WARNING
Found the following significant warnings:
  doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
See ‘/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
* used SDK: ‘MacOSX11.3.sdk’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 1 WARNING, 2 NOTEs
See
  ‘/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.71.1’
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘MacOSX11.3.sdk’
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c init_package.c -o init_package.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/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 Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.107   0.038   0.146 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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] "/Users/biocbuild/bbs-3.21-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) limit (Mb) max used (Mb)
Ncells 480164 25.7    1054624 56.4         NA   634545 33.9
Vcells 889893  6.8    8388608 64.0     196608  2108497 16.1
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jan 28 18:17:14 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 Jan 28 18:17:14 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: 0x600001558000>
> 
> 
> 
> 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 Jan 28 18:17:15 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 Jan 28 18:17:15 2025"
> 
> ColMode(tmp2)
<pointer: 0x600001558000>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]        [,3]       [,4]
[1,] 98.5465524  0.0335819 -0.02164245 -0.4417323
[2,]  1.0715497 -0.5196425 -0.94425846  1.5349757
[3,] -1.9598656  1.8819786  0.81984916  0.5014375
[4,]  0.8594649  0.5834446 -0.03852555 -1.8029567
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.21-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,] 98.5465524 0.0335819 0.02164245 0.4417323
[2,]  1.0715497 0.5196425 0.94425846 1.5349757
[3,]  1.9598656 1.8819786 0.81984916 0.5014375
[4,]  0.8594649 0.5834446 0.03852555 1.8029567
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.21-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,] 9.9270616 0.1832537 0.1471137 0.6646294
[2,] 1.0351569 0.7208623 0.9717296 1.2389414
[3,] 1.3999520 1.3718522 0.9054552 0.7081225
[4,] 0.9270733 0.7638355 0.1962793 1.3427422
> 
> 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:    /Users/biocbuild/bbs-3.21-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,] 222.81717 26.86612 26.49278 32.08803
[2,]  36.42312 32.72827 35.66155 38.92439
[3,]  40.95939 40.60050 34.87440 32.58266
[4,]  35.13020 33.22180 27.00132 40.23038
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x600001558060>
> exp(tmp5)
<pointer: 0x600001558060>
> log(tmp5,2)
<pointer: 0x600001558060>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 463.7647
> Min(tmp5)
[1] 55.01965
> mean(tmp5)
[1] 72.62579
> Sum(tmp5)
[1] 14525.16
> Var(tmp5)
[1] 843.8894
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.60853 71.19241 72.59736 70.13302 68.22627 69.21738 70.88857 71.51225
 [9] 71.96855 71.91352
> rowSums(tmp5)
 [1] 1772.171 1423.848 1451.947 1402.660 1364.525 1384.348 1417.771 1430.245
 [9] 1439.371 1438.270
> rowVars(tmp5)
 [1] 7907.64982   63.64128   72.53680   94.79819   69.11239   68.31166
 [7]   42.54727   70.32580   56.73894   77.29785
> rowSd(tmp5)
 [1] 88.924967  7.977548  8.516854  9.736436  8.313386  8.265087  6.522827
 [8]  8.386048  7.532526  8.791919
> rowMax(tmp5)
 [1] 463.76474  90.18853  86.95047  94.98470  82.64316  84.27327  84.58919
 [8]  86.13561  87.23507  89.24149
> rowMin(tmp5)
 [1] 55.10069 56.45696 59.98311 56.19971 55.01965 57.37564 60.13888 55.86071
 [9] 59.69200 58.05472
> 
> colMeans(tmp5)
 [1] 113.09506  70.46977  67.73686  73.24919  64.52433  73.78120  69.86265
 [8]  69.69120  66.52557  71.10677  68.01098  74.19121  72.95575  67.59796
[15]  69.66371  72.39592  71.02313  71.66244  73.38665  71.58536
> colSums(tmp5)
 [1] 1130.9506  704.6977  677.3686  732.4919  645.2433  737.8120  698.6265
 [8]  696.9120  665.2557  711.0677  680.1098  741.9121  729.5575  675.9796
[15]  696.6371  723.9592  710.2313  716.6244  733.8665  715.8536
> colVars(tmp5)
 [1] 15236.67797    68.17541    68.08377    65.21905    44.11386    82.17265
 [7]    32.05675   109.04473    57.40503    98.08867    45.73628    80.96789
[13]   102.14536    71.37188    86.93805    28.94225    46.66527   102.98688
[19]   105.93738    68.20766
> colSd(tmp5)
 [1] 123.436939   8.256840   8.251289   8.075831   6.641826   9.064913
 [7]   5.661868  10.442448   7.576611   9.903973   6.762860   8.998216
[13]  10.106699   8.448188   9.324058   5.379800   6.831198  10.148245
[19]  10.292589   8.258793
> colMax(tmp5)
 [1] 463.76474  84.50462  81.23133  84.27327  75.37343  86.51613  76.49672
 [8]  86.95047  81.83630  90.18853  79.33252  87.23507  89.24149  80.37940
[15]  86.13561  82.64316  85.18234  83.61377  94.98470  83.62850
> colMin(tmp5)
 [1] 57.64371 55.91831 55.14125 64.79287 55.01965 61.30601 59.69200 57.05150
 [9] 55.10069 55.86071 57.44079 61.23117 57.46264 56.45696 59.36429 64.51349
[17] 61.12369 59.98311 57.37564 57.49624
> 
> 
> ### 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] 88.60853 71.19241 72.59736 70.13302 68.22627 69.21738       NA 71.51225
 [9] 71.96855 71.91352
> rowSums(tmp5)
 [1] 1772.171 1423.848 1451.947 1402.660 1364.525 1384.348       NA 1430.245
 [9] 1439.371 1438.270
> rowVars(tmp5)
 [1] 7907.64982   63.64128   72.53680   94.79819   69.11239   68.31166
 [7]   44.35749   70.32580   56.73894   77.29785
> rowSd(tmp5)
 [1] 88.924967  7.977548  8.516854  9.736436  8.313386  8.265087  6.660142
 [8]  8.386048  7.532526  8.791919
> rowMax(tmp5)
 [1] 463.76474  90.18853  86.95047  94.98470  82.64316  84.27327        NA
 [8]  86.13561  87.23507  89.24149
> rowMin(tmp5)
 [1] 55.10069 56.45696 59.98311 56.19971 55.01965 57.37564       NA 55.86071
 [9] 59.69200 58.05472
> 
> colMeans(tmp5)
 [1] 113.09506  70.46977  67.73686  73.24919        NA  73.78120  69.86265
 [8]  69.69120  66.52557  71.10677  68.01098  74.19121  72.95575  67.59796
[15]  69.66371  72.39592  71.02313  71.66244  73.38665  71.58536
> colSums(tmp5)
 [1] 1130.9506  704.6977  677.3686  732.4919        NA  737.8120  698.6265
 [8]  696.9120  665.2557  711.0677  680.1098  741.9121  729.5575  675.9796
[15]  696.6371  723.9592  710.2313  716.6244  733.8665  715.8536
> colVars(tmp5)
 [1] 15236.67797    68.17541    68.08377    65.21905          NA    82.17265
 [7]    32.05675   109.04473    57.40503    98.08867    45.73628    80.96789
[13]   102.14536    71.37188    86.93805    28.94225    46.66527   102.98688
[19]   105.93738    68.20766
> colSd(tmp5)
 [1] 123.436939   8.256840   8.251289   8.075831         NA   9.064913
 [7]   5.661868  10.442448   7.576611   9.903973   6.762860   8.998216
[13]  10.106699   8.448188   9.324058   5.379800   6.831198  10.148245
[19]  10.292589   8.258793
> colMax(tmp5)
 [1] 463.76474  84.50462  81.23133  84.27327        NA  86.51613  76.49672
 [8]  86.95047  81.83630  90.18853  79.33252  87.23507  89.24149  80.37940
[15]  86.13561  82.64316  85.18234  83.61377  94.98470  83.62850
> colMin(tmp5)
 [1] 57.64371 55.91831 55.14125 64.79287       NA 61.30601 59.69200 57.05150
 [9] 55.10069 55.86071 57.44079 61.23117 57.46264 56.45696 59.36429 64.51349
[17] 61.12369 59.98311 57.37564 57.49624
> 
> Max(tmp5,na.rm=TRUE)
[1] 463.7647
> Min(tmp5,na.rm=TRUE)
[1] 55.01965
> mean(tmp5,na.rm=TRUE)
[1] 72.64997
> Sum(tmp5,na.rm=TRUE)
[1] 14457.34
> Var(tmp5,na.rm=TRUE)
[1] 848.0338
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.60853 71.19241 72.59736 70.13302 68.22627 69.21738 71.05050 71.51225
 [9] 71.96855 71.91352
> rowSums(tmp5,na.rm=TRUE)
 [1] 1772.171 1423.848 1451.947 1402.660 1364.525 1384.348 1349.959 1430.245
 [9] 1439.371 1438.270
> rowVars(tmp5,na.rm=TRUE)
 [1] 7907.64982   63.64128   72.53680   94.79819   69.11239   68.31166
 [7]   44.35749   70.32580   56.73894   77.29785
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.924967  7.977548  8.516854  9.736436  8.313386  8.265087  6.660142
 [8]  8.386048  7.532526  8.791919
> rowMax(tmp5,na.rm=TRUE)
 [1] 463.76474  90.18853  86.95047  94.98470  82.64316  84.27327  84.58919
 [8]  86.13561  87.23507  89.24149
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.10069 56.45696 59.98311 56.19971 55.01965 57.37564 60.13888 55.86071
 [9] 59.69200 58.05472
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.09506  70.46977  67.73686  73.24919  64.15903  73.78120  69.86265
 [8]  69.69120  66.52557  71.10677  68.01098  74.19121  72.95575  67.59796
[15]  69.66371  72.39592  71.02313  71.66244  73.38665  71.58536
> colSums(tmp5,na.rm=TRUE)
 [1] 1130.9506  704.6977  677.3686  732.4919  577.4313  737.8120  698.6265
 [8]  696.9120  665.2557  711.0677  680.1098  741.9121  729.5575  675.9796
[15]  696.6371  723.9592  710.2313  716.6244  733.8665  715.8536
> colVars(tmp5,na.rm=TRUE)
 [1] 15236.67797    68.17541    68.08377    65.21905    48.12686    82.17265
 [7]    32.05675   109.04473    57.40503    98.08867    45.73628    80.96789
[13]   102.14536    71.37188    86.93805    28.94225    46.66527   102.98688
[19]   105.93738    68.20766
> colSd(tmp5,na.rm=TRUE)
 [1] 123.436939   8.256840   8.251289   8.075831   6.937353   9.064913
 [7]   5.661868  10.442448   7.576611   9.903973   6.762860   8.998216
[13]  10.106699   8.448188   9.324058   5.379800   6.831198  10.148245
[19]  10.292589   8.258793
> colMax(tmp5,na.rm=TRUE)
 [1] 463.76474  84.50462  81.23133  84.27327  75.37343  86.51613  76.49672
 [8]  86.95047  81.83630  90.18853  79.33252  87.23507  89.24149  80.37940
[15]  86.13561  82.64316  85.18234  83.61377  94.98470  83.62850
> colMin(tmp5,na.rm=TRUE)
 [1] 57.64371 55.91831 55.14125 64.79287 55.01965 61.30601 59.69200 57.05150
 [9] 55.10069 55.86071 57.44079 61.23117 57.46264 56.45696 59.36429 64.51349
[17] 61.12369 59.98311 57.37564 57.49624
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.60853 71.19241 72.59736 70.13302 68.22627 69.21738      NaN 71.51225
 [9] 71.96855 71.91352
> rowSums(tmp5,na.rm=TRUE)
 [1] 1772.171 1423.848 1451.947 1402.660 1364.525 1384.348    0.000 1430.245
 [9] 1439.371 1438.270
> rowVars(tmp5,na.rm=TRUE)
 [1] 7907.64982   63.64128   72.53680   94.79819   69.11239   68.31166
 [7]         NA   70.32580   56.73894   77.29785
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.924967  7.977548  8.516854  9.736436  8.313386  8.265087        NA
 [8]  8.386048  7.532526  8.791919
> rowMax(tmp5,na.rm=TRUE)
 [1] 463.76474  90.18853  86.95047  94.98470  82.64316  84.27327        NA
 [8]  86.13561  87.23507  89.24149
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.10069 56.45696 59.98311 56.19971 55.01965 57.37564       NA 55.86071
 [9] 59.69200 58.05472
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.56351  70.71535  68.58108  74.18878       NaN  72.58031  69.81406
 [8]  69.29937  66.87369  71.37600  68.30792  73.56642  72.08230  66.85393
[15]  70.14550  72.12779  70.80569  72.74387  73.08371  71.50788
> colSums(tmp5,na.rm=TRUE)
 [1] 1058.0716  636.4382  617.2297  667.6990    0.0000  653.2228  628.3265
 [8]  623.6943  601.8632  642.3840  614.7712  662.0977  648.7407  601.6854
[15]  631.3095  649.1501  637.2512  654.6948  657.7533  643.5709
> colVars(tmp5,na.rm=TRUE)
 [1] 16916.63322    76.01886    68.57628    63.43958          NA    76.22023
 [7]    36.03728   120.94806    63.21726   109.53428    50.46136    86.69719
[13]   106.33075    74.06548    95.19399    31.75124    51.96650   102.70352
[19]   118.14707    76.66609
> colSd(tmp5,na.rm=TRUE)
 [1] 130.063958   8.718879   8.281080   7.964897         NA   8.730420
 [7]   6.003106  10.997639   7.950928  10.465863   7.103616   9.311132
[13]  10.311680   8.606130   9.756741   5.634824   7.208779  10.134274
[19]  10.869548   8.755917
> colMax(tmp5,na.rm=TRUE)
 [1] 463.76474  84.50462  81.23133  84.27327      -Inf  86.51613  76.49672
 [8]  86.95047  81.83630  90.18853  79.33252  87.23507  89.24149  80.37940
[15]  86.13561  82.64316  85.18234  83.61377  94.98470  83.62850
> colMin(tmp5,na.rm=TRUE)
 [1] 57.64371 55.91831 55.14125 65.67866      Inf 61.30601 59.69200 57.05150
 [9] 55.10069 55.86071 57.44079 61.23117 57.46264 56.45696 59.36429 64.51349
[17] 61.12369 59.98311 57.37564 57.49624
> 
> 
> 
> 
> 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] 303.4361 312.2885 173.6489 211.1899 317.6770 195.9067 225.1086 251.9159
 [9] 216.8799 207.8217
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 303.4361 312.2885 173.6489 211.1899 317.6770 195.9067 225.1086 251.9159
 [9] 216.8799 207.8217
> 
> 
> 
> 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.563194e-13 -1.705303e-13 -1.421085e-13 -5.684342e-14  5.684342e-14
 [6]  0.000000e+00  5.684342e-14 -8.526513e-14 -9.947598e-14 -8.526513e-14
[11] -2.842171e-14  1.421085e-13 -3.410605e-13 -1.136868e-13 -5.684342e-14
[16] -1.278977e-13 -1.136868e-13  5.684342e-14  1.705303e-13 -9.947598e-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)
+ }
1   20 
1   3 
4   15 
7   13 
2   11 
4   14 
9   11 
4   10 
5   18 
8   14 
8   3 
7   1 
2   11 
3   18 
5   11 
3   7 
6   12 
10   18 
8   12 
9   5 
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.61247
> Min(tmp)
[1] -2.25679
> mean(tmp)
[1] 0.007632558
> Sum(tmp)
[1] 0.7632558
> Var(tmp)
[1] 0.9588543
> 
> rowMeans(tmp)
[1] 0.007632558
> rowSums(tmp)
[1] 0.7632558
> rowVars(tmp)
[1] 0.9588543
> rowSd(tmp)
[1] 0.9792111
> rowMax(tmp)
[1] 2.61247
> rowMin(tmp)
[1] -2.25679
> 
> colMeans(tmp)
  [1] -1.320498654 -1.345841248  0.489739069  0.278044209 -0.052064888
  [6]  1.196690427  1.126534933 -0.052320969  1.554207872  0.034965921
 [11] -0.382188981 -0.455107400  0.417595721 -0.182047362 -0.745151048
 [16]  0.124144636  0.442016239 -0.281509136  0.537445724  0.871167050
 [21] -0.137647419 -0.391461108 -0.173817863 -1.053350009 -0.383129714
 [26]  1.041549197  0.602410220 -0.059661878  0.188461039  1.010398437
 [31]  0.795327873  1.193493132 -0.359739327 -0.249495939 -1.679808120
 [36] -1.834600625  1.433427012 -0.348902386 -1.679333446  0.272380286
 [41]  0.803222622 -0.549819363 -0.064342562 -0.301704159 -0.006171285
 [46] -0.780238647  0.757373870 -0.583024654  1.512774676  2.414018698
 [51]  1.654173147  0.651835273 -0.919416006  0.807929218 -0.294666520
 [56] -0.272203636 -0.709452417 -1.544700466 -1.076703858 -0.001339895
 [61]  2.066246830 -0.556047495  0.611710292 -0.144970591  0.339988101
 [66] -0.399474978 -1.318553282  0.287053231  0.116928575  1.120905796
 [71]  0.612421386  1.218859342  0.575881051  0.936383149  0.211070584
 [76] -1.469285848 -2.256790489 -0.468922967  0.607757921  2.612470382
 [81]  0.570285758 -1.411350752 -0.753444835 -1.158314461 -1.584197788
 [86]  0.170123024  0.964080116 -1.611113514  0.036988866  0.428298470
 [91]  0.439186608  0.577621315 -0.433941491  1.272825717 -0.551963806
 [96] -2.010825369  1.229017687 -1.062287036 -0.334857359 -0.656371851
> colSums(tmp)
  [1] -1.320498654 -1.345841248  0.489739069  0.278044209 -0.052064888
  [6]  1.196690427  1.126534933 -0.052320969  1.554207872  0.034965921
 [11] -0.382188981 -0.455107400  0.417595721 -0.182047362 -0.745151048
 [16]  0.124144636  0.442016239 -0.281509136  0.537445724  0.871167050
 [21] -0.137647419 -0.391461108 -0.173817863 -1.053350009 -0.383129714
 [26]  1.041549197  0.602410220 -0.059661878  0.188461039  1.010398437
 [31]  0.795327873  1.193493132 -0.359739327 -0.249495939 -1.679808120
 [36] -1.834600625  1.433427012 -0.348902386 -1.679333446  0.272380286
 [41]  0.803222622 -0.549819363 -0.064342562 -0.301704159 -0.006171285
 [46] -0.780238647  0.757373870 -0.583024654  1.512774676  2.414018698
 [51]  1.654173147  0.651835273 -0.919416006  0.807929218 -0.294666520
 [56] -0.272203636 -0.709452417 -1.544700466 -1.076703858 -0.001339895
 [61]  2.066246830 -0.556047495  0.611710292 -0.144970591  0.339988101
 [66] -0.399474978 -1.318553282  0.287053231  0.116928575  1.120905796
 [71]  0.612421386  1.218859342  0.575881051  0.936383149  0.211070584
 [76] -1.469285848 -2.256790489 -0.468922967  0.607757921  2.612470382
 [81]  0.570285758 -1.411350752 -0.753444835 -1.158314461 -1.584197788
 [86]  0.170123024  0.964080116 -1.611113514  0.036988866  0.428298470
 [91]  0.439186608  0.577621315 -0.433941491  1.272825717 -0.551963806
 [96] -2.010825369  1.229017687 -1.062287036 -0.334857359 -0.656371851
> 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.320498654 -1.345841248  0.489739069  0.278044209 -0.052064888
  [6]  1.196690427  1.126534933 -0.052320969  1.554207872  0.034965921
 [11] -0.382188981 -0.455107400  0.417595721 -0.182047362 -0.745151048
 [16]  0.124144636  0.442016239 -0.281509136  0.537445724  0.871167050
 [21] -0.137647419 -0.391461108 -0.173817863 -1.053350009 -0.383129714
 [26]  1.041549197  0.602410220 -0.059661878  0.188461039  1.010398437
 [31]  0.795327873  1.193493132 -0.359739327 -0.249495939 -1.679808120
 [36] -1.834600625  1.433427012 -0.348902386 -1.679333446  0.272380286
 [41]  0.803222622 -0.549819363 -0.064342562 -0.301704159 -0.006171285
 [46] -0.780238647  0.757373870 -0.583024654  1.512774676  2.414018698
 [51]  1.654173147  0.651835273 -0.919416006  0.807929218 -0.294666520
 [56] -0.272203636 -0.709452417 -1.544700466 -1.076703858 -0.001339895
 [61]  2.066246830 -0.556047495  0.611710292 -0.144970591  0.339988101
 [66] -0.399474978 -1.318553282  0.287053231  0.116928575  1.120905796
 [71]  0.612421386  1.218859342  0.575881051  0.936383149  0.211070584
 [76] -1.469285848 -2.256790489 -0.468922967  0.607757921  2.612470382
 [81]  0.570285758 -1.411350752 -0.753444835 -1.158314461 -1.584197788
 [86]  0.170123024  0.964080116 -1.611113514  0.036988866  0.428298470
 [91]  0.439186608  0.577621315 -0.433941491  1.272825717 -0.551963806
 [96] -2.010825369  1.229017687 -1.062287036 -0.334857359 -0.656371851
> colMin(tmp)
  [1] -1.320498654 -1.345841248  0.489739069  0.278044209 -0.052064888
  [6]  1.196690427  1.126534933 -0.052320969  1.554207872  0.034965921
 [11] -0.382188981 -0.455107400  0.417595721 -0.182047362 -0.745151048
 [16]  0.124144636  0.442016239 -0.281509136  0.537445724  0.871167050
 [21] -0.137647419 -0.391461108 -0.173817863 -1.053350009 -0.383129714
 [26]  1.041549197  0.602410220 -0.059661878  0.188461039  1.010398437
 [31]  0.795327873  1.193493132 -0.359739327 -0.249495939 -1.679808120
 [36] -1.834600625  1.433427012 -0.348902386 -1.679333446  0.272380286
 [41]  0.803222622 -0.549819363 -0.064342562 -0.301704159 -0.006171285
 [46] -0.780238647  0.757373870 -0.583024654  1.512774676  2.414018698
 [51]  1.654173147  0.651835273 -0.919416006  0.807929218 -0.294666520
 [56] -0.272203636 -0.709452417 -1.544700466 -1.076703858 -0.001339895
 [61]  2.066246830 -0.556047495  0.611710292 -0.144970591  0.339988101
 [66] -0.399474978 -1.318553282  0.287053231  0.116928575  1.120905796
 [71]  0.612421386  1.218859342  0.575881051  0.936383149  0.211070584
 [76] -1.469285848 -2.256790489 -0.468922967  0.607757921  2.612470382
 [81]  0.570285758 -1.411350752 -0.753444835 -1.158314461 -1.584197788
 [86]  0.170123024  0.964080116 -1.611113514  0.036988866  0.428298470
 [91]  0.439186608  0.577621315 -0.433941491  1.272825717 -0.551963806
 [96] -2.010825369  1.229017687 -1.062287036 -0.334857359 -0.656371851
> colMedians(tmp)
  [1] -1.320498654 -1.345841248  0.489739069  0.278044209 -0.052064888
  [6]  1.196690427  1.126534933 -0.052320969  1.554207872  0.034965921
 [11] -0.382188981 -0.455107400  0.417595721 -0.182047362 -0.745151048
 [16]  0.124144636  0.442016239 -0.281509136  0.537445724  0.871167050
 [21] -0.137647419 -0.391461108 -0.173817863 -1.053350009 -0.383129714
 [26]  1.041549197  0.602410220 -0.059661878  0.188461039  1.010398437
 [31]  0.795327873  1.193493132 -0.359739327 -0.249495939 -1.679808120
 [36] -1.834600625  1.433427012 -0.348902386 -1.679333446  0.272380286
 [41]  0.803222622 -0.549819363 -0.064342562 -0.301704159 -0.006171285
 [46] -0.780238647  0.757373870 -0.583024654  1.512774676  2.414018698
 [51]  1.654173147  0.651835273 -0.919416006  0.807929218 -0.294666520
 [56] -0.272203636 -0.709452417 -1.544700466 -1.076703858 -0.001339895
 [61]  2.066246830 -0.556047495  0.611710292 -0.144970591  0.339988101
 [66] -0.399474978 -1.318553282  0.287053231  0.116928575  1.120905796
 [71]  0.612421386  1.218859342  0.575881051  0.936383149  0.211070584
 [76] -1.469285848 -2.256790489 -0.468922967  0.607757921  2.612470382
 [81]  0.570285758 -1.411350752 -0.753444835 -1.158314461 -1.584197788
 [86]  0.170123024  0.964080116 -1.611113514  0.036988866  0.428298470
 [91]  0.439186608  0.577621315 -0.433941491  1.272825717 -0.551963806
 [96] -2.010825369  1.229017687 -1.062287036 -0.334857359 -0.656371851
> colRanges(tmp)
          [,1]      [,2]      [,3]      [,4]        [,5]    [,6]     [,7]
[1,] -1.320499 -1.345841 0.4897391 0.2780442 -0.05206489 1.19669 1.126535
[2,] -1.320499 -1.345841 0.4897391 0.2780442 -0.05206489 1.19669 1.126535
            [,8]     [,9]      [,10]     [,11]      [,12]     [,13]      [,14]
[1,] -0.05232097 1.554208 0.03496592 -0.382189 -0.4551074 0.4175957 -0.1820474
[2,] -0.05232097 1.554208 0.03496592 -0.382189 -0.4551074 0.4175957 -0.1820474
         [,15]     [,16]     [,17]      [,18]     [,19]     [,20]      [,21]
[1,] -0.745151 0.1241446 0.4420162 -0.2815091 0.5374457 0.8711671 -0.1376474
[2,] -0.745151 0.1241446 0.4420162 -0.2815091 0.5374457 0.8711671 -0.1376474
          [,22]      [,23]    [,24]      [,25]    [,26]     [,27]       [,28]
[1,] -0.3914611 -0.1738179 -1.05335 -0.3831297 1.041549 0.6024102 -0.05966188
[2,] -0.3914611 -0.1738179 -1.05335 -0.3831297 1.041549 0.6024102 -0.05966188
        [,29]    [,30]     [,31]    [,32]      [,33]      [,34]     [,35]
[1,] 0.188461 1.010398 0.7953279 1.193493 -0.3597393 -0.2494959 -1.679808
[2,] 0.188461 1.010398 0.7953279 1.193493 -0.3597393 -0.2494959 -1.679808
         [,36]    [,37]      [,38]     [,39]     [,40]     [,41]      [,42]
[1,] -1.834601 1.433427 -0.3489024 -1.679333 0.2723803 0.8032226 -0.5498194
[2,] -1.834601 1.433427 -0.3489024 -1.679333 0.2723803 0.8032226 -0.5498194
           [,43]      [,44]        [,45]      [,46]     [,47]      [,48]
[1,] -0.06434256 -0.3017042 -0.006171285 -0.7802386 0.7573739 -0.5830247
[2,] -0.06434256 -0.3017042 -0.006171285 -0.7802386 0.7573739 -0.5830247
        [,49]    [,50]    [,51]     [,52]     [,53]     [,54]      [,55]
[1,] 1.512775 2.414019 1.654173 0.6518353 -0.919416 0.8079292 -0.2946665
[2,] 1.512775 2.414019 1.654173 0.6518353 -0.919416 0.8079292 -0.2946665
          [,56]      [,57]   [,58]     [,59]        [,60]    [,61]      [,62]
[1,] -0.2722036 -0.7094524 -1.5447 -1.076704 -0.001339895 2.066247 -0.5560475
[2,] -0.2722036 -0.7094524 -1.5447 -1.076704 -0.001339895 2.066247 -0.5560475
         [,63]      [,64]     [,65]     [,66]     [,67]     [,68]     [,69]
[1,] 0.6117103 -0.1449706 0.3399881 -0.399475 -1.318553 0.2870532 0.1169286
[2,] 0.6117103 -0.1449706 0.3399881 -0.399475 -1.318553 0.2870532 0.1169286
        [,70]     [,71]    [,72]     [,73]     [,74]     [,75]     [,76]
[1,] 1.120906 0.6124214 1.218859 0.5758811 0.9363831 0.2110706 -1.469286
[2,] 1.120906 0.6124214 1.218859 0.5758811 0.9363831 0.2110706 -1.469286
        [,77]     [,78]     [,79]   [,80]     [,81]     [,82]      [,83]
[1,] -2.25679 -0.468923 0.6077579 2.61247 0.5702858 -1.411351 -0.7534448
[2,] -2.25679 -0.468923 0.6077579 2.61247 0.5702858 -1.411351 -0.7534448
         [,84]     [,85]    [,86]     [,87]     [,88]      [,89]     [,90]
[1,] -1.158314 -1.584198 0.170123 0.9640801 -1.611114 0.03698887 0.4282985
[2,] -1.158314 -1.584198 0.170123 0.9640801 -1.611114 0.03698887 0.4282985
         [,91]     [,92]      [,93]    [,94]      [,95]     [,96]    [,97]
[1,] 0.4391866 0.5776213 -0.4339415 1.272826 -0.5519638 -2.010825 1.229018
[2,] 0.4391866 0.5776213 -0.4339415 1.272826 -0.5519638 -2.010825 1.229018
         [,98]      [,99]     [,100]
[1,] -1.062287 -0.3348574 -0.6563719
[2,] -1.062287 -0.3348574 -0.6563719
> 
> 
> Max(tmp2)
[1] 3.188366
> Min(tmp2)
[1] -2.307085
> mean(tmp2)
[1] -0.1241384
> Sum(tmp2)
[1] -12.41384
> Var(tmp2)
[1] 1.315937
> 
> rowMeans(tmp2)
  [1]  0.07991978  0.83000594 -1.29150697  0.96796593  0.47750802 -0.14094799
  [7] -1.46199638 -1.39601377 -1.11167320 -1.57697953  0.02961655 -0.38646581
 [13] -0.92856735  0.38099421  2.31827482 -1.43604047  0.14513230 -0.26112307
 [19]  0.61323730 -1.88199018 -1.60791271  2.57510973  0.81501112 -0.78400983
 [25] -0.86790522 -0.75857933  1.47678361 -1.73060759 -0.16429173 -0.76875188
 [31]  0.23932153 -0.04868111 -0.13928327 -0.44875324  0.32672838 -1.31411894
 [37] -0.56400328 -0.46637234 -0.30849755  0.66185838 -0.42292952  1.59695169
 [43]  0.12931651  0.73379384 -0.90333712 -0.33132429  0.87196687  0.29477152
 [49] -0.66506321  3.18836648  0.83121659  0.89254654 -0.56778974  0.54176483
 [55]  1.07352621  1.43571262  0.88348888  1.29758147 -1.59073859 -0.37530177
 [61] -1.89290095 -1.09986930 -1.29743758 -1.39775872 -0.46381241 -1.77004645
 [67] -0.17416663  0.33582067 -0.30682527 -0.32701763 -1.35379141 -0.18969116
 [73]  1.75017183 -0.31373773  2.13279952 -1.78669863  1.07771933  0.52401669
 [79] -0.55656105 -1.45614055  0.80241015 -1.17825655 -0.49642243  0.51494719
 [85] -1.52071879  1.03746582  0.78540789 -0.56543059  1.27839518 -0.27362945
 [91] -2.30708476 -0.27684423  1.51655008 -2.09764554  0.32771762 -1.77255854
 [97]  1.99181335  1.38737051 -1.41979293 -0.58852115
> rowSums(tmp2)
  [1]  0.07991978  0.83000594 -1.29150697  0.96796593  0.47750802 -0.14094799
  [7] -1.46199638 -1.39601377 -1.11167320 -1.57697953  0.02961655 -0.38646581
 [13] -0.92856735  0.38099421  2.31827482 -1.43604047  0.14513230 -0.26112307
 [19]  0.61323730 -1.88199018 -1.60791271  2.57510973  0.81501112 -0.78400983
 [25] -0.86790522 -0.75857933  1.47678361 -1.73060759 -0.16429173 -0.76875188
 [31]  0.23932153 -0.04868111 -0.13928327 -0.44875324  0.32672838 -1.31411894
 [37] -0.56400328 -0.46637234 -0.30849755  0.66185838 -0.42292952  1.59695169
 [43]  0.12931651  0.73379384 -0.90333712 -0.33132429  0.87196687  0.29477152
 [49] -0.66506321  3.18836648  0.83121659  0.89254654 -0.56778974  0.54176483
 [55]  1.07352621  1.43571262  0.88348888  1.29758147 -1.59073859 -0.37530177
 [61] -1.89290095 -1.09986930 -1.29743758 -1.39775872 -0.46381241 -1.77004645
 [67] -0.17416663  0.33582067 -0.30682527 -0.32701763 -1.35379141 -0.18969116
 [73]  1.75017183 -0.31373773  2.13279952 -1.78669863  1.07771933  0.52401669
 [79] -0.55656105 -1.45614055  0.80241015 -1.17825655 -0.49642243  0.51494719
 [85] -1.52071879  1.03746582  0.78540789 -0.56543059  1.27839518 -0.27362945
 [91] -2.30708476 -0.27684423  1.51655008 -2.09764554  0.32771762 -1.77255854
 [97]  1.99181335  1.38737051 -1.41979293 -0.58852115
> 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.07991978  0.83000594 -1.29150697  0.96796593  0.47750802 -0.14094799
  [7] -1.46199638 -1.39601377 -1.11167320 -1.57697953  0.02961655 -0.38646581
 [13] -0.92856735  0.38099421  2.31827482 -1.43604047  0.14513230 -0.26112307
 [19]  0.61323730 -1.88199018 -1.60791271  2.57510973  0.81501112 -0.78400983
 [25] -0.86790522 -0.75857933  1.47678361 -1.73060759 -0.16429173 -0.76875188
 [31]  0.23932153 -0.04868111 -0.13928327 -0.44875324  0.32672838 -1.31411894
 [37] -0.56400328 -0.46637234 -0.30849755  0.66185838 -0.42292952  1.59695169
 [43]  0.12931651  0.73379384 -0.90333712 -0.33132429  0.87196687  0.29477152
 [49] -0.66506321  3.18836648  0.83121659  0.89254654 -0.56778974  0.54176483
 [55]  1.07352621  1.43571262  0.88348888  1.29758147 -1.59073859 -0.37530177
 [61] -1.89290095 -1.09986930 -1.29743758 -1.39775872 -0.46381241 -1.77004645
 [67] -0.17416663  0.33582067 -0.30682527 -0.32701763 -1.35379141 -0.18969116
 [73]  1.75017183 -0.31373773  2.13279952 -1.78669863  1.07771933  0.52401669
 [79] -0.55656105 -1.45614055  0.80241015 -1.17825655 -0.49642243  0.51494719
 [85] -1.52071879  1.03746582  0.78540789 -0.56543059  1.27839518 -0.27362945
 [91] -2.30708476 -0.27684423  1.51655008 -2.09764554  0.32771762 -1.77255854
 [97]  1.99181335  1.38737051 -1.41979293 -0.58852115
> rowMin(tmp2)
  [1]  0.07991978  0.83000594 -1.29150697  0.96796593  0.47750802 -0.14094799
  [7] -1.46199638 -1.39601377 -1.11167320 -1.57697953  0.02961655 -0.38646581
 [13] -0.92856735  0.38099421  2.31827482 -1.43604047  0.14513230 -0.26112307
 [19]  0.61323730 -1.88199018 -1.60791271  2.57510973  0.81501112 -0.78400983
 [25] -0.86790522 -0.75857933  1.47678361 -1.73060759 -0.16429173 -0.76875188
 [31]  0.23932153 -0.04868111 -0.13928327 -0.44875324  0.32672838 -1.31411894
 [37] -0.56400328 -0.46637234 -0.30849755  0.66185838 -0.42292952  1.59695169
 [43]  0.12931651  0.73379384 -0.90333712 -0.33132429  0.87196687  0.29477152
 [49] -0.66506321  3.18836648  0.83121659  0.89254654 -0.56778974  0.54176483
 [55]  1.07352621  1.43571262  0.88348888  1.29758147 -1.59073859 -0.37530177
 [61] -1.89290095 -1.09986930 -1.29743758 -1.39775872 -0.46381241 -1.77004645
 [67] -0.17416663  0.33582067 -0.30682527 -0.32701763 -1.35379141 -0.18969116
 [73]  1.75017183 -0.31373773  2.13279952 -1.78669863  1.07771933  0.52401669
 [79] -0.55656105 -1.45614055  0.80241015 -1.17825655 -0.49642243  0.51494719
 [85] -1.52071879  1.03746582  0.78540789 -0.56543059  1.27839518 -0.27362945
 [91] -2.30708476 -0.27684423  1.51655008 -2.09764554  0.32771762 -1.77255854
 [97]  1.99181335  1.38737051 -1.41979293 -0.58852115
> 
> colMeans(tmp2)
[1] -0.1241384
> colSums(tmp2)
[1] -12.41384
> colVars(tmp2)
[1] 1.315937
> colSd(tmp2)
[1] 1.147143
> colMax(tmp2)
[1] 3.188366
> colMin(tmp2)
[1] -2.307085
> colMedians(tmp2)
[1] -0.2752368
> colRanges(tmp2)
          [,1]
[1,] -2.307085
[2,]  3.188366
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.369080  3.430698 -5.306587  3.883559  2.091573 -1.173246  4.524237
 [8]  4.293726  3.917954  2.443112
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.62929018
[2,] -0.38189172
[3,] -0.07715158
[4,]  0.32518228
[5,]  1.19959887
> 
> rowApply(tmp,sum)
 [1] -3.23033200 -0.67225716  3.40753737  2.35049799 -0.05388669  1.72928885
 [7]  2.40453782  1.74913353  5.78654290  2.26488417
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    6    1    2    5    1    7    7    2     7
 [2,]    8    4    4    6    1    7    9    2   10     9
 [3,]    1    1    2    8   10    2    2    1    3     6
 [4,]    4    3    6    9    9    8    8    9    6     1
 [5,]    6    2    9    1    7    6    4    6    5    10
 [6,]    2    9    3    7    2    3    3    4    7     3
 [7,]    7    5    7    4    8   10    5    5    9     2
 [8,]    3   10    8    3    4    9    6    8    4     8
 [9,]    5    7    5   10    6    5    1   10    8     4
[10,]    9    8   10    5    3    4   10    3    1     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.022793928 -1.137348856 -0.472405743 -1.982603004 -0.801030046
 [6] -0.927622716 -2.683658404  0.002022831  0.359887502 -3.041735108
[11]  0.895378516  0.738870467  0.623145075  3.960997439  2.413396088
[16] -5.049601661  0.313230678 -1.968525054  0.988539278 -0.522486385
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8537860
[2,] -1.3001182
[3,] -0.6409353
[4,]  0.5587960
[5,]  1.2132496
> 
> rowApply(tmp,sum)
[1]  0.09834475  1.27862633 -2.65194611 -1.32116733 -7.71820068
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   15    3    1    5   18
[2,]    1   13   19   13   17
[3,]    3   18   12   11   11
[4,]   10   10   13    4    4
[5,]    7    5    8   12   16
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]        [,4]       [,5]       [,6]
[1,]  0.5587960 -3.8656908 -1.15188474  0.03168413 -0.1880677  0.4989538
[2,] -1.3001182  0.3211578  1.17730517 -0.07431034 -0.5581782 -0.8564247
[3,] -1.8537860  1.3513686 -0.05130622  0.17658637 -0.5907659  0.1945991
[4,] -0.6409353  0.1347400 -0.08487868 -0.74903317  0.0659241  0.2655385
[5,]  1.2132496  0.9210756 -0.36164128 -1.36752999  0.4700576 -1.0302894
            [,7]        [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.02046845  0.05443147 -0.6098140 -1.4174922  0.03356372  1.2006047
[2,] -2.40521918  0.62668971  1.9200364 -0.4608048  0.13277457 -1.3568623
[3,] -1.22802057 -1.30201074  0.3535012 -0.7328968  1.28856537  0.9837206
[4,]  0.91759103 -1.29329272  1.6383156  0.2210444 -2.15572664  0.9458597
[5,]  0.01152187  1.91620510 -2.9421516 -0.6515857  1.59620149 -1.0344523
           [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.03994438  2.6668700  1.4014995 -0.9587442  0.9035256 -0.6369067
[2,]  0.36083826  2.3884970  1.1601222 -0.1985954 -0.2970644 -0.4045783
[3,] -1.34262276 -1.1446375  1.8860828 -1.1084644 -0.1323118 -0.3635290
[4,]  2.54227992 -0.3838871 -0.2010751 -0.3869316  0.5441870 -0.3348945
[5,] -0.89740596  0.4341551 -1.8332333 -2.3968661 -0.7051057 -0.2286166
          [,19]       [,20]
[1,]  1.5602012  0.03629104
[2,]  0.9486417  0.15471928
[3,]  1.0430561 -0.07907439
[4,] -1.9023231 -0.46366967
[5,] -0.6610366 -0.17075265
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.21-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:    /Users/biocbuild/bbs-3.21-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:    /Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  562  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.21-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.385425 -0.1716423 0.1364533 0.2819179 0.4370747 -0.3664235 -0.6417135
         col8      col9      col10     col11    col12    col13    col14
row1 1.801097 0.6013345 -0.2693625 0.2261523 1.373418 1.227527 1.803251
         col15    col16      col17     col18       col19      col20
row1 -1.770925 1.700097 -0.4066465 0.5926209 -0.09411033 -0.4851058
> tmp[,"col10"]
          col10
row1 -0.2693625
row2  0.2349367
row3 -1.2466602
row4 -1.1709680
row5  0.8776646
> tmp[c("row1","row5"),]
          col1        col2      col3      col4       col5       col6       col7
row1 -1.385425 -0.17164231 0.1364533 0.2819179  0.4370747 -0.3664235 -0.6417135
row5  2.225967  0.03722004 0.2013387 0.2294714 -1.7231991  0.6008053 -0.1142825
          col8       col9      col10      col11     col12     col13      col14
row1 1.8010969 0.60133446 -0.2693625  0.2261523 1.3734178  1.227527  1.8032505
row5 0.9602453 0.01568393  0.8776646 -0.3421731 0.4092815 -1.943257 -0.2725502
          col15     col16      col17      col18       col19      col20
row1 -1.7709247  1.700097 -0.4066465  0.5926209 -0.09411033 -0.4851058
row5 -0.7797115 -0.149051 -1.0831307 -0.8892142  0.44742803 -0.7907540
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.3664235 -0.4851058
row2 -0.1606247  1.4069260
row3  1.1945699 -0.5842737
row4 -0.2413358  0.5599870
row5  0.6008053 -0.7907540
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.3664235 -0.4851058
row5  0.6008053 -0.7907540
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
        col1     col2     col3     col4     col5     col6     col7    col8
row1 49.6924 50.79541 49.20875 49.49961 48.99185 104.4603 52.57234 49.9752
         col9    col10    col11    col12    col13    col14  col15    col16
row1 46.95446 48.71996 49.15057 49.44799 49.52978 49.43422 51.768 49.30249
        col17    col18    col19    col20
row1 48.75638 49.12953 50.19268 102.2846
> tmp[,"col10"]
        col10
row1 48.71996
row2 30.12237
row3 29.10126
row4 30.95430
row5 51.39014
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.69240 50.79541 49.20875 49.49961 48.99185 104.4603 52.57234 49.97520
row5 50.21457 50.52943 50.61208 48.39973 51.13495 103.6731 48.57023 51.61342
         col9    col10    col11    col12    col13    col14    col15    col16
row1 46.95446 48.71996 49.15057 49.44799 49.52978 49.43422 51.76800 49.30249
row5 49.63610 51.39014 49.24448 49.57135 48.94897 51.10932 48.56255 51.12991
        col17    col18    col19    col20
row1 48.75638 49.12953 50.19268 102.2846
row5 49.68212 49.96477 49.49480 104.6175
> tmp[,c("col6","col20")]
          col6     col20
row1 104.46027 102.28463
row2  73.99027  75.57958
row3  76.48316  76.23163
row4  74.68624  74.54619
row5 103.67305 104.61747
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.4603 102.2846
row5 103.6731 104.6175
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.4603 102.2846
row5 103.6731 104.6175
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.3046810
[2,]  1.7368437
[3,] -0.7598609
[4,] -1.4247584
[5,]  1.5601835
> tmp[,c("col17","col7")]
         col17       col7
[1,] 0.8292983 -0.6189964
[2,] 0.7344583 -0.4562643
[3,] 0.9717712 -0.2501536
[4,] 1.5457160  3.7329134
[5,] 0.2670014 -0.8309683
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.27998390 -0.8174959
[2,]  0.04789242  1.4235026
[3,]  0.75797217 -0.8389043
[4,] -0.17329296 -1.5049095
[5,] -1.17830361  1.5586333
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2799839
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.27998390
[2,]  0.04789242
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]      [,2]       [,3]       [,4]       [,5]       [,6]       [,7]
row3 0.7918773 0.9165954  0.5707198  0.6797104  1.6789293 -0.8504034 -1.6207516
row1 0.2109500 0.1972051 -0.3604360 -0.7128864 -0.5849061 -1.1389788  0.8486393
           [,8]       [,9]     [,10]      [,11]     [,12]      [,13]      [,14]
row3  1.5955895 -0.2022587 1.5986692 -0.9690434 0.1847973 -2.4460954 -0.4897318
row1 -0.1039295  2.1208611 0.8721737 -0.7108975 0.1920437 -0.7023691 -1.1362437
          [,15]      [,16]      [,17]       [,18]     [,19]      [,20]
row3 -0.3211005  0.4432477 -1.1679042  0.36699021 1.3315376 -0.6421317
row1  0.6894406 -2.0495018 -0.9556854 -0.03876442 0.1292649 -0.8266629
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row2 1.125854 -0.9200404 -2.010106 -1.193106 0.6456329 0.7335845 0.3122092
          [,8]      [,9]     [,10]
row2 0.5923875 -1.390077 -1.864427
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]      [,2]     [,3]      [,4]       [,5]       [,6]       [,7]
row5 1.551252 0.3814271 1.097267 0.7305085 -0.7416617 -0.2057475 -0.5909107
          [,8]        [,9]     [,10]     [,11]      [,12]     [,13]      [,14]
row5 -0.380822 -0.06411718 0.3953108 0.2655646 0.02808619 -1.014643 -0.6926293
        [,15]       [,16]     [,17]      [,18]     [,19]     [,20]
row5 1.855655 -0.09641569 0.2081538 -0.4892805 0.4461708 0.1225252
> 
> 
> 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: 0x600001568000>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a4d871dda"
 [2] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a61b8faf9"
 [3] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a3765238e"
 [4] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a51015c0b"
 [5] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a3041ffb9"
 [6] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a3cfbe36f"
 [7] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a3d10abb0"
 [8] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a1177cf22"
 [9] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a50bfca23"
[10] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a5f6fe93f"
[11] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a2c3a580c"
[12] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a2a6a9283"
[13] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a3ab8ec36"
[14] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795a429beb58"
[15] "/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests/BM795aa780092" 
> 
> 
> ### 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: 0x60000156c180>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x60000156c180>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.21-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x60000156c180>
> rowMedians(tmp)
  [1]  0.1515228343  0.0814741796  0.2567696722  0.7890600135 -0.1227527292
  [6]  0.2127996192  0.0345935198  0.4709720008  0.0917678564 -0.4177211070
 [11]  0.2048936488 -0.2186182985 -0.2085633360 -0.0389303313 -0.5688128567
 [16] -0.0219787469 -0.0969490541 -0.2242418400  0.6155761910 -0.1343972196
 [21]  0.2221411932  0.4664593493 -0.2738672596 -0.4279056563 -0.0096304316
 [26] -0.2169155673  0.4684379698 -0.4316212708 -0.0375710729  0.0868785777
 [31] -0.3864577053 -0.3984390737  0.0061044112  0.2221837851  0.4978058007
 [36] -0.0687654488  0.5268889040  0.4820785366 -0.1169443272  0.0423133904
 [41]  0.5381203336  0.0719967700  0.2709537095  0.2284612668 -0.1778436572
 [46] -0.0767310744  0.1295984320 -0.5746944870  0.3810716300  0.2602714542
 [51] -0.0097637173  0.2299219009  0.2333721723 -0.0879332345  0.2015322531
 [56] -0.0050697342  0.0195338542  0.1191116236 -0.2310392135 -0.1696311668
 [61] -0.3160072182  0.4901431346  0.2626909055 -0.0074845598 -0.1298090056
 [66]  0.2041701432 -0.0315548834 -0.0347835680 -0.0818509541  0.0373947598
 [71]  0.3292450442 -0.0654109051 -0.5015307477  0.2879438745 -0.4230472630
 [76] -0.4231866284  0.1552635187 -0.0499649393  0.5027706975 -0.0043817689
 [81]  0.2589269184 -0.5025612375 -0.4145339526  0.3775531007 -0.4623716666
 [86] -0.1960067753 -0.9316862124 -0.1976497402 -0.1196587979 -0.2370465961
 [91]  0.0093754657  0.3596935341 -0.1716611387 -0.1182044495  0.0969653037
 [96] -0.0154479836  0.0408943315 -0.2231205630  0.3295035763 -0.4221000004
[101]  0.1142557196 -0.0472451890 -0.1549457064  0.2473410601  0.1281311152
[106]  0.1440266943 -0.2830958672  0.2398303897 -0.0644692134 -0.0161550780
[111]  0.1535132376 -0.3113333567 -0.2798658169 -0.1742486416 -0.0381488085
[116] -0.2682023422 -0.5174879483  0.3080775600 -0.1888463454  0.1992180057
[121] -0.5893281953 -0.4030997438 -0.3914865161 -0.0946977012  0.0545476536
[126] -0.3106037083  0.1404518339 -0.1360537911 -0.0796009650 -0.1089988031
[131] -0.2115525348  0.0625437406  0.0455979985 -0.4402565873  0.0727717618
[136]  0.3639362015 -0.1641960022 -0.2480863425  0.8339963572 -0.1789470106
[141]  0.2193982504  0.3043964713 -0.0236497600  0.3435326425  0.1262926547
[146] -0.1849941023 -0.4374044754  0.6021799305 -0.1164660793 -0.2469093703
[151]  0.0102327685 -0.0724051552 -0.3298758978 -0.0107807894  0.0926680576
[156]  0.3442945319  0.2519041992 -0.1211336818 -0.5418512458 -0.2029140515
[161] -0.2697448891  0.1005504657  0.0737357171 -0.5323913893 -0.1833642520
[166]  0.0412251778 -0.0277421581  0.0554170310  0.4802201958 -0.0206820560
[171] -0.0125743856  0.2016463427 -0.5874366737 -0.1951458562  0.4052349140
[176] -0.3997158568  0.4987170464 -0.3286482228  0.3939871313  0.3472901124
[181]  0.1397307472  0.1841642403  0.4431981481  0.0974549371  0.3860233917
[186]  0.0400247065  0.1450947594 -0.3910024418 -0.3608988083  0.7228290289
[191]  0.1596685941  0.2990696973  0.0431672562  0.0294896757  0.1707296560
[196]  0.1808480859  0.5087465400 -0.1968188049  0.3047239788  0.1665237531
[201] -0.1239041026  0.3296910397  0.0811728018  0.0752346075 -0.4069471696
[206]  0.2478436503 -0.6093173689  0.3058387057 -0.1221241113 -0.2966148624
[211]  0.1479149394 -0.6322836931  0.1031213764  0.0511232453 -0.0458889912
[216]  0.0570700591  0.0754529524  0.3244330965 -0.1281117736  0.3509396362
[221] -0.0005368762 -0.3050014606  0.1120358935  0.0722663188  0.0927789982
[226]  0.0678960656 -0.2879344883  0.3423816900 -0.2000267355  0.3260158462
> 
> proc.time()
   user  system elapsed 
  0.637   3.161   3.966 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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: 0x6000024e4000>
> .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: 0x6000024e4000>
> .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: 0x6000024e4000>
> .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: 0x6000024e4000>
> 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: 0x6000024d4540>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024d4540>
> .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: 0x6000024d4540>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024d4540>
> .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: 0x6000024d4540>
> 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: 0x6000024d4720>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024d4720>
> .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: 0x6000024d4720>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6000024d4720>
> .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: 0x6000024d4720>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x6000024d4720>
> .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: 0x6000024d4720>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x6000024d4720>
> .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: 0x6000024d4720>
> 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: 0x6000024c03c0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x6000024c03c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024c03c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024c03c0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile7a8e4bc70704" "BufferedMatrixFile7a8e779dbe79"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile7a8e4bc70704" "BufferedMatrixFile7a8e779dbe79"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024c0660>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024c0660>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x6000024c0660>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x6000024c0660>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x6000024c0660>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x6000024c0660>
> .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: 0x6000024c0840>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000024c0840>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6000024c0840>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x6000024c0840>
> 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: 0x6000024e8060>
> .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: 0x6000024e8060>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.112   0.042   0.155 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2025-01-20 r87609) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.114   0.027   0.142 

Example timings