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

This page was generated on 2024-07-04 11:44 -0400 (Thu, 04 Jul 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 22.04.3 LTS)x86_644.4.1 (2024-06-14) -- "Race for Your Life" 4411
palomino6Windows Server 2022 Datacenterx644.4.1 (2024-06-14 ucrt) -- "Race for Your Life" 4413
lconwaymacOS 12.7.1 Montereyx86_644.4.1 (2024-06-14) -- "Race for Your Life" 4395
kjohnson3macOS 13.6.5 Venturaarm644.4.1 (2024-06-14) -- "Race for Your Life" 4390
kunpeng2Linux (openEuler 22.03 LTS-SP1)aarch644.4.0 (2024-04-24) -- "Puppy Cup" 4407
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/2243HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.69.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-07-03 14:00 -0400 (Wed, 03 Jul 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: d422a05
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo2Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino6Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  
lconwaymacOS 12.7.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.6.5 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kunpeng2Linux (openEuler 22.03 LTS-SP1) / aarch64  OK    OK    OK  


CHECK results for BufferedMatrix on kunpeng2

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

raw results


Summary

Package: BufferedMatrix
Version: 1.69.0
Command: /home/biocbuild/R/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R/site-library --no-vignettes --timings BufferedMatrix_1.69.0.tar.gz
StartedAt: 2024-07-04 03:10:45 -0000 (Thu, 04 Jul 2024)
EndedAt: 2024-07-04 03:11:08 -0000 (Thu, 04 Jul 2024)
EllapsedTime: 23.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.0 (2024-04-24)
* using platform: aarch64-unknown-linux-gnu
* R was compiled by
    gcc (GCC) 12.2.1 20220819 (openEuler 12.2.1-14)
    GNU Fortran (GCC) 10.3.1
* running under: openEuler 22.03 (LTS-SP1)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.69.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘gcc (GCC) 10.3.1’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/R/R-4.4.0/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (GCC) 10.3.1’
gcc -I"/home/biocbuild/R/R-4.4.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/R/R-4.4.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/R/R-4.4.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/R/R-4.4.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/R/R-4.4.0/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/R/R-4.4.0/lib -lR
installing to /home/biocbuild/R/R-4.4.0/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.328   0.033   0.346 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 471779 25.2    1026215 54.9   643448 34.4
Vcells 871879  6.7    8388608 64.0  2044613 15.6
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Jul  4 03:11:02 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Jul  4 03:11:02 2024"
> 
> 
> 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: 0xbba0f80>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu Jul  4 03:11:03 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Jul  4 03:11:03 2024"
> 
> ColMode(tmp2)
<pointer: 0xbba0f80>
> 
> 
> 
> ### 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,] 101.9489584  2.6850823 -0.1375670 -0.9224852
[2,]  -0.1611288  0.1214964 -0.5131305 -0.1389403
[3,]   0.3058150  2.3978093 -1.0889284 -1.0072561
[4,]  -0.3008294 -1.7813540 -0.5790982  1.5701434
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 101.9489584 2.6850823 0.1375670 0.9224852
[2,]   0.1611288 0.1214964 0.5131305 0.1389403
[3,]   0.3058150 2.3978093 1.0889284 1.0072561
[4,]   0.3008294 1.7813540 0.5790982 1.5701434
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0969777 1.6386221 0.3709002 0.9604609
[2,]  0.4014086 0.3485633 0.7163313 0.3727469
[3,]  0.5530054 1.5484861 1.0435173 1.0036215
[4,]  0.5484792 1.3346737 0.7609850 1.2530536
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 227.91874 44.07130 28.84657 35.52709
[2,]  29.17521 28.60713 32.67644 28.86641
[3,]  30.83587 42.88267 36.52410 36.04347
[4,]  30.78562 40.12809 33.18895 39.10068
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xb1378c0>
> exp(tmp5)
<pointer: 0xb1378c0>
> log(tmp5,2)
<pointer: 0xb1378c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 474.383
> Min(tmp5)
[1] 53.70187
> mean(tmp5)
[1] 72.75361
> Sum(tmp5)
[1] 14550.72
> Var(tmp5)
[1] 894.509
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 94.50987 66.80398 69.03001 72.48599 70.77518 70.24732 71.51854 71.17101
 [9] 72.40485 68.58935
> rowSums(tmp5)
 [1] 1890.197 1336.080 1380.600 1449.720 1415.504 1404.946 1430.371 1423.420
 [9] 1448.097 1371.787
> rowVars(tmp5)
 [1] 8093.70581   79.04617   67.33729   74.63111   66.01663   95.95189
 [7]   84.10111   75.19641   72.99894   76.28450
> rowSd(tmp5)
 [1] 89.965025  8.890791  8.205930  8.638930  8.125062  9.795504  9.170666
 [8]  8.671586  8.543942  8.734100
> rowMax(tmp5)
 [1] 474.38299  86.45821  89.25466  89.38149  88.35351  85.36174  88.76007
 [8]  84.46344  85.63396  86.28895
> rowMin(tmp5)
 [1] 57.40892 54.95608 58.38411 60.18863 53.70187 54.58762 55.82315 58.22245
 [9] 56.72023 55.09924
> 
> colMeans(tmp5)
 [1] 109.19771  78.38922  68.73694  73.59183  70.86396  72.34868  69.31322
 [8]  74.00253  71.24408  68.35464  72.51809  69.01153  67.33698  72.85537
[15]  68.25766  73.10686  70.95012  71.12412  69.56222  64.30642
> colSums(tmp5)
 [1] 1091.9771  783.8922  687.3694  735.9183  708.6396  723.4868  693.1322
 [8]  740.0253  712.4408  683.5464  725.1809  690.1153  673.3698  728.5537
[15]  682.5766  731.0686  709.5012  711.2412  695.6222  643.0642
> colVars(tmp5)
 [1] 16499.43669    89.88019    44.04637    52.92194    81.37279    26.26454
 [7]    87.53292   102.08747    50.58550    77.94903   143.83232    58.60967
[13]    48.93274   146.44000    78.15711    68.56540   105.51154   117.72508
[19]   106.45972    51.47228
> colSd(tmp5)
 [1] 128.450133   9.480516   6.636744   7.274747   9.020687   5.124894
 [7]   9.355903  10.103834   7.112348   8.828875  11.993011   7.655695
[13]   6.995194  12.101240   8.840651   8.280423  10.271881  10.850119
[19]  10.317932   7.174418
> colMax(tmp5)
 [1] 474.38299  91.72864  78.35850  84.46344  85.36174  81.70154  79.84766
 [8]  85.08034  84.10508  81.72107  90.21755  81.50516  77.74473  89.38149
[15]  80.03725  86.60037  88.35351  88.98009  86.45821  76.89628
> colMin(tmp5)
 [1] 60.72439 59.54199 58.22245 60.08165 58.59398 64.29998 55.24274 55.92991
 [9] 60.97530 57.40892 56.72023 56.17673 57.78578 54.95608 56.29268 60.18863
[17] 57.38601 57.62496 54.58762 53.70187
> 
> 
> ### 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] 94.50987 66.80398 69.03001 72.48599 70.77518 70.24732 71.51854 71.17101
 [9] 72.40485       NA
> rowSums(tmp5)
 [1] 1890.197 1336.080 1380.600 1449.720 1415.504 1404.946 1430.371 1423.420
 [9] 1448.097       NA
> rowVars(tmp5)
 [1] 8093.70581   79.04617   67.33729   74.63111   66.01663   95.95189
 [7]   84.10111   75.19641   72.99894   79.53638
> rowSd(tmp5)
 [1] 89.965025  8.890791  8.205930  8.638930  8.125062  9.795504  9.170666
 [8]  8.671586  8.543942  8.918317
> rowMax(tmp5)
 [1] 474.38299  86.45821  89.25466  89.38149  88.35351  85.36174  88.76007
 [8]  84.46344  85.63396        NA
> rowMin(tmp5)
 [1] 57.40892 54.95608 58.38411 60.18863 53.70187 54.58762 55.82315 58.22245
 [9] 56.72023       NA
> 
> colMeans(tmp5)
 [1] 109.19771  78.38922  68.73694  73.59183  70.86396  72.34868  69.31322
 [8]  74.00253  71.24408  68.35464  72.51809  69.01153        NA  72.85537
[15]  68.25766  73.10686  70.95012  71.12412  69.56222  64.30642
> colSums(tmp5)
 [1] 1091.9771  783.8922  687.3694  735.9183  708.6396  723.4868  693.1322
 [8]  740.0253  712.4408  683.5464  725.1809  690.1153        NA  728.5537
[15]  682.5766  731.0686  709.5012  711.2412  695.6222  643.0642
> colVars(tmp5)
 [1] 16499.43669    89.88019    44.04637    52.92194    81.37279    26.26454
 [7]    87.53292   102.08747    50.58550    77.94903   143.83232    58.60967
[13]          NA   146.44000    78.15711    68.56540   105.51154   117.72508
[19]   106.45972    51.47228
> colSd(tmp5)
 [1] 128.450133   9.480516   6.636744   7.274747   9.020687   5.124894
 [7]   9.355903  10.103834   7.112348   8.828875  11.993011   7.655695
[13]         NA  12.101240   8.840651   8.280423  10.271881  10.850119
[19]  10.317932   7.174418
> colMax(tmp5)
 [1] 474.38299  91.72864  78.35850  84.46344  85.36174  81.70154  79.84766
 [8]  85.08034  84.10508  81.72107  90.21755  81.50516        NA  89.38149
[15]  80.03725  86.60037  88.35351  88.98009  86.45821  76.89628
> colMin(tmp5)
 [1] 60.72439 59.54199 58.22245 60.08165 58.59398 64.29998 55.24274 55.92991
 [9] 60.97530 57.40892 56.72023 56.17673       NA 54.95608 56.29268 60.18863
[17] 57.38601 57.62496 54.58762 53.70187
> 
> Max(tmp5,na.rm=TRUE)
[1] 474.383
> Min(tmp5,na.rm=TRUE)
[1] 53.70187
> mean(tmp5,na.rm=TRUE)
[1] 72.79517
> Sum(tmp5,na.rm=TRUE)
[1] 14486.24
> Var(tmp5,na.rm=TRUE)
[1] 898.6795
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.50987 66.80398 69.03001 72.48599 70.77518 70.24732 71.51854 71.17101
 [9] 72.40485 68.80548
> rowSums(tmp5,na.rm=TRUE)
 [1] 1890.197 1336.080 1380.600 1449.720 1415.504 1404.946 1430.371 1423.420
 [9] 1448.097 1307.304
> rowVars(tmp5,na.rm=TRUE)
 [1] 8093.70581   79.04617   67.33729   74.63111   66.01663   95.95189
 [7]   84.10111   75.19641   72.99894   79.53638
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.965025  8.890791  8.205930  8.638930  8.125062  9.795504  9.170666
 [8]  8.671586  8.543942  8.918317
> rowMax(tmp5,na.rm=TRUE)
 [1] 474.38299  86.45821  89.25466  89.38149  88.35351  85.36174  88.76007
 [8]  84.46344  85.63396  86.28895
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.40892 54.95608 58.38411 60.18863 53.70187 54.58762 55.82315 58.22245
 [9] 56.72023 55.09924
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.19771  78.38922  68.73694  73.59183  70.86396  72.34868  69.31322
 [8]  74.00253  71.24408  68.35464  72.51809  69.01153  67.65410  72.85537
[15]  68.25766  73.10686  70.95012  71.12412  69.56222  64.30642
> colSums(tmp5,na.rm=TRUE)
 [1] 1091.9771  783.8922  687.3694  735.9183  708.6396  723.4868  693.1322
 [8]  740.0253  712.4408  683.5464  725.1809  690.1153  608.8869  728.5537
[15]  682.5766  731.0686  709.5012  711.2412  695.6222  643.0642
> colVars(tmp5,na.rm=TRUE)
 [1] 16499.43669    89.88019    44.04637    52.92194    81.37279    26.26454
 [7]    87.53292   102.08747    50.58550    77.94903   143.83232    58.60967
[13]    53.91795   146.44000    78.15711    68.56540   105.51154   117.72508
[19]   106.45972    51.47228
> colSd(tmp5,na.rm=TRUE)
 [1] 128.450133   9.480516   6.636744   7.274747   9.020687   5.124894
 [7]   9.355903  10.103834   7.112348   8.828875  11.993011   7.655695
[13]   7.342885  12.101240   8.840651   8.280423  10.271881  10.850119
[19]  10.317932   7.174418
> colMax(tmp5,na.rm=TRUE)
 [1] 474.38299  91.72864  78.35850  84.46344  85.36174  81.70154  79.84766
 [8]  85.08034  84.10508  81.72107  90.21755  81.50516  77.74473  89.38149
[15]  80.03725  86.60037  88.35351  88.98009  86.45821  76.89628
> colMin(tmp5,na.rm=TRUE)
 [1] 60.72439 59.54199 58.22245 60.08165 58.59398 64.29998 55.24274 55.92991
 [9] 60.97530 57.40892 56.72023 56.17673 57.78578 54.95608 56.29268 60.18863
[17] 57.38601 57.62496 54.58762 53.70187
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.50987 66.80398 69.03001 72.48599 70.77518 70.24732 71.51854 71.17101
 [9] 72.40485      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1890.197 1336.080 1380.600 1449.720 1415.504 1404.946 1430.371 1423.420
 [9] 1448.097    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 8093.70581   79.04617   67.33729   74.63111   66.01663   95.95189
 [7]   84.10111   75.19641   72.99894         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.965025  8.890791  8.205930  8.638930  8.125062  9.795504  9.170666
 [8]  8.671586  8.543942        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 474.38299  86.45821  89.25466  89.38149  88.35351  85.36174  88.76007
 [8]  84.46344  85.63396        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.40892 54.95608 58.38411 60.18863 53.70187 54.58762 55.82315 58.22245
 [9] 56.72023       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.33784  78.83163  69.34701  73.45622  71.53110  71.94369  69.08856
 [8]  76.01060  71.77151  67.12920  70.98800  70.43762       NaN  73.04594
[15]  68.71910  72.58600  72.04572  70.45526  70.61755  65.32944
> colSums(tmp5,na.rm=TRUE)
 [1] 1020.0405  709.4847  624.1231  661.1060  643.7799  647.4932  621.7970
 [8]  684.0954  645.9436  604.1628  638.8920  633.9386    0.0000  657.4135
[15]  618.4719  653.2740  648.4115  634.0974  635.5579  587.9650
> colVars(tmp5,na.rm=TRUE)
 [1] 18369.03397    98.91328    45.36517    59.33029    86.53732    27.70243
 [7]    97.90672    69.48457    53.77911    70.79853   135.47295    43.05642
[13]          NA   164.33642    85.53130    74.08404   105.19655   127.40785
[19]   107.23791    46.13240
> colSd(tmp5,na.rm=TRUE)
 [1] 135.532409   9.945516   6.735367   7.702616   9.302544   5.263310
 [7]   9.894783   8.335741   7.333424   8.414186  11.639285   6.561739
[13]         NA  12.819377   9.248313   8.607209  10.256537  11.287508
[19]  10.355574   6.792084
> colMax(tmp5,na.rm=TRUE)
 [1] 474.38299  91.72864  78.35850  84.46344  85.36174  81.70154  79.84766
 [8]  85.08034  84.10508  81.72107  90.21755  81.50516      -Inf  89.38149
[15]  80.03725  86.60037  88.35351  88.98009  86.45821  76.89628
> colMin(tmp5,na.rm=TRUE)
 [1] 60.72439 59.54199 58.22245 60.08165 58.59398 64.29998 55.24274 58.34197
 [9] 60.97530 57.40892 56.72023 63.54427      Inf 54.95608 56.29268 60.18863
[17] 57.38601 57.62496 54.58762 53.70187
> 
> 
> 
> 
> 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] 585.9335 225.7535 291.9066 362.7453 172.0912 264.4948 167.5707 323.5640
 [9] 321.5579 598.6300
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 585.9335 225.7535 291.9066 362.7453 172.0912 264.4948 167.5707 323.5640
 [9] 321.5579 598.6300
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  2.273737e-13  1.421085e-14 -1.705303e-13  3.410605e-13  1.136868e-13
 [6] -2.842171e-14  5.684342e-14 -1.136868e-13  0.000000e+00  0.000000e+00
[11] -8.526513e-14  1.136868e-13  5.684342e-14  8.526513e-14 -2.842171e-14
[16]  0.000000e+00  2.273737e-13  2.273737e-13 -5.684342e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   15 
6   17 
9   2 
8   14 
4   15 
5   9 
5   15 
3   15 
5   20 
8   12 
2   6 
1   15 
10   10 
10   20 
3   13 
4   8 
1   17 
6   7 
2   20 
2   2 
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.562772
> Min(tmp)
[1] -1.736795
> mean(tmp)
[1] 0.01508117
> Sum(tmp)
[1] 1.508117
> Var(tmp)
[1] 0.8599195
> 
> rowMeans(tmp)
[1] 0.01508117
> rowSums(tmp)
[1] 1.508117
> rowVars(tmp)
[1] 0.8599195
> rowSd(tmp)
[1] 0.9273185
> rowMax(tmp)
[1] 2.562772
> rowMin(tmp)
[1] -1.736795
> 
> colMeans(tmp)
  [1]  0.71354992 -0.42406884  1.56555760  0.43769887 -0.37904406  1.06012002
  [7] -1.68699564 -0.65479724  0.13088091 -0.76292844 -1.49946213  0.49445273
 [13]  1.20236026 -1.02495346  0.50194817  1.84629527 -0.92016750  1.79857790
 [19] -0.12210866 -0.16750315 -0.26559281 -0.28410257 -1.09255573 -1.35406514
 [25] -0.02356704 -0.12664471  0.67390031  1.80682721  0.49800006 -0.99942342
 [31] -1.49373721  0.19474450 -0.37136023  1.05795903  0.60593308 -0.81151187
 [37]  1.58078809  0.95106829 -0.28678120  0.02992387 -0.04886932 -0.09395709
 [43]  0.55863587 -0.64771643 -0.04116704  0.47961924 -0.23515868  0.71458428
 [49] -0.07355395  0.77606932 -0.43349059 -1.31209863  0.31128129 -1.10496387
 [55]  1.09956760  0.36470992 -0.88010102 -1.49785436  1.03976169 -0.87464476
 [61]  0.49430221 -0.19776730  0.10378933 -0.63274589 -1.34516310 -0.47102169
 [67]  0.19430715 -0.26637571  0.77608791  0.80946106 -1.34666689 -0.09629073
 [73]  1.11060996 -0.64688502  1.07622994 -1.07117016  0.44297229  0.16238502
 [79] -0.24464240  0.93067532  0.45086239  2.56277217 -0.50734389 -1.73679472
 [85]  0.47045888 -0.48604266 -1.16501087 -0.99384438 -0.03211560 -1.56862094
 [91]  0.85129302  0.19406417 -0.20369894  1.14032784  0.55286413  0.76323806
 [97] -0.60898275 -1.09217075  2.25783416  0.37706768
> colSums(tmp)
  [1]  0.71354992 -0.42406884  1.56555760  0.43769887 -0.37904406  1.06012002
  [7] -1.68699564 -0.65479724  0.13088091 -0.76292844 -1.49946213  0.49445273
 [13]  1.20236026 -1.02495346  0.50194817  1.84629527 -0.92016750  1.79857790
 [19] -0.12210866 -0.16750315 -0.26559281 -0.28410257 -1.09255573 -1.35406514
 [25] -0.02356704 -0.12664471  0.67390031  1.80682721  0.49800006 -0.99942342
 [31] -1.49373721  0.19474450 -0.37136023  1.05795903  0.60593308 -0.81151187
 [37]  1.58078809  0.95106829 -0.28678120  0.02992387 -0.04886932 -0.09395709
 [43]  0.55863587 -0.64771643 -0.04116704  0.47961924 -0.23515868  0.71458428
 [49] -0.07355395  0.77606932 -0.43349059 -1.31209863  0.31128129 -1.10496387
 [55]  1.09956760  0.36470992 -0.88010102 -1.49785436  1.03976169 -0.87464476
 [61]  0.49430221 -0.19776730  0.10378933 -0.63274589 -1.34516310 -0.47102169
 [67]  0.19430715 -0.26637571  0.77608791  0.80946106 -1.34666689 -0.09629073
 [73]  1.11060996 -0.64688502  1.07622994 -1.07117016  0.44297229  0.16238502
 [79] -0.24464240  0.93067532  0.45086239  2.56277217 -0.50734389 -1.73679472
 [85]  0.47045888 -0.48604266 -1.16501087 -0.99384438 -0.03211560 -1.56862094
 [91]  0.85129302  0.19406417 -0.20369894  1.14032784  0.55286413  0.76323806
 [97] -0.60898275 -1.09217075  2.25783416  0.37706768
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.71354992 -0.42406884  1.56555760  0.43769887 -0.37904406  1.06012002
  [7] -1.68699564 -0.65479724  0.13088091 -0.76292844 -1.49946213  0.49445273
 [13]  1.20236026 -1.02495346  0.50194817  1.84629527 -0.92016750  1.79857790
 [19] -0.12210866 -0.16750315 -0.26559281 -0.28410257 -1.09255573 -1.35406514
 [25] -0.02356704 -0.12664471  0.67390031  1.80682721  0.49800006 -0.99942342
 [31] -1.49373721  0.19474450 -0.37136023  1.05795903  0.60593308 -0.81151187
 [37]  1.58078809  0.95106829 -0.28678120  0.02992387 -0.04886932 -0.09395709
 [43]  0.55863587 -0.64771643 -0.04116704  0.47961924 -0.23515868  0.71458428
 [49] -0.07355395  0.77606932 -0.43349059 -1.31209863  0.31128129 -1.10496387
 [55]  1.09956760  0.36470992 -0.88010102 -1.49785436  1.03976169 -0.87464476
 [61]  0.49430221 -0.19776730  0.10378933 -0.63274589 -1.34516310 -0.47102169
 [67]  0.19430715 -0.26637571  0.77608791  0.80946106 -1.34666689 -0.09629073
 [73]  1.11060996 -0.64688502  1.07622994 -1.07117016  0.44297229  0.16238502
 [79] -0.24464240  0.93067532  0.45086239  2.56277217 -0.50734389 -1.73679472
 [85]  0.47045888 -0.48604266 -1.16501087 -0.99384438 -0.03211560 -1.56862094
 [91]  0.85129302  0.19406417 -0.20369894  1.14032784  0.55286413  0.76323806
 [97] -0.60898275 -1.09217075  2.25783416  0.37706768
> colMin(tmp)
  [1]  0.71354992 -0.42406884  1.56555760  0.43769887 -0.37904406  1.06012002
  [7] -1.68699564 -0.65479724  0.13088091 -0.76292844 -1.49946213  0.49445273
 [13]  1.20236026 -1.02495346  0.50194817  1.84629527 -0.92016750  1.79857790
 [19] -0.12210866 -0.16750315 -0.26559281 -0.28410257 -1.09255573 -1.35406514
 [25] -0.02356704 -0.12664471  0.67390031  1.80682721  0.49800006 -0.99942342
 [31] -1.49373721  0.19474450 -0.37136023  1.05795903  0.60593308 -0.81151187
 [37]  1.58078809  0.95106829 -0.28678120  0.02992387 -0.04886932 -0.09395709
 [43]  0.55863587 -0.64771643 -0.04116704  0.47961924 -0.23515868  0.71458428
 [49] -0.07355395  0.77606932 -0.43349059 -1.31209863  0.31128129 -1.10496387
 [55]  1.09956760  0.36470992 -0.88010102 -1.49785436  1.03976169 -0.87464476
 [61]  0.49430221 -0.19776730  0.10378933 -0.63274589 -1.34516310 -0.47102169
 [67]  0.19430715 -0.26637571  0.77608791  0.80946106 -1.34666689 -0.09629073
 [73]  1.11060996 -0.64688502  1.07622994 -1.07117016  0.44297229  0.16238502
 [79] -0.24464240  0.93067532  0.45086239  2.56277217 -0.50734389 -1.73679472
 [85]  0.47045888 -0.48604266 -1.16501087 -0.99384438 -0.03211560 -1.56862094
 [91]  0.85129302  0.19406417 -0.20369894  1.14032784  0.55286413  0.76323806
 [97] -0.60898275 -1.09217075  2.25783416  0.37706768
> colMedians(tmp)
  [1]  0.71354992 -0.42406884  1.56555760  0.43769887 -0.37904406  1.06012002
  [7] -1.68699564 -0.65479724  0.13088091 -0.76292844 -1.49946213  0.49445273
 [13]  1.20236026 -1.02495346  0.50194817  1.84629527 -0.92016750  1.79857790
 [19] -0.12210866 -0.16750315 -0.26559281 -0.28410257 -1.09255573 -1.35406514
 [25] -0.02356704 -0.12664471  0.67390031  1.80682721  0.49800006 -0.99942342
 [31] -1.49373721  0.19474450 -0.37136023  1.05795903  0.60593308 -0.81151187
 [37]  1.58078809  0.95106829 -0.28678120  0.02992387 -0.04886932 -0.09395709
 [43]  0.55863587 -0.64771643 -0.04116704  0.47961924 -0.23515868  0.71458428
 [49] -0.07355395  0.77606932 -0.43349059 -1.31209863  0.31128129 -1.10496387
 [55]  1.09956760  0.36470992 -0.88010102 -1.49785436  1.03976169 -0.87464476
 [61]  0.49430221 -0.19776730  0.10378933 -0.63274589 -1.34516310 -0.47102169
 [67]  0.19430715 -0.26637571  0.77608791  0.80946106 -1.34666689 -0.09629073
 [73]  1.11060996 -0.64688502  1.07622994 -1.07117016  0.44297229  0.16238502
 [79] -0.24464240  0.93067532  0.45086239  2.56277217 -0.50734389 -1.73679472
 [85]  0.47045888 -0.48604266 -1.16501087 -0.99384438 -0.03211560 -1.56862094
 [91]  0.85129302  0.19406417 -0.20369894  1.14032784  0.55286413  0.76323806
 [97] -0.60898275 -1.09217075  2.25783416  0.37706768
> colRanges(tmp)
          [,1]       [,2]     [,3]      [,4]       [,5]    [,6]      [,7]
[1,] 0.7135499 -0.4240688 1.565558 0.4376989 -0.3790441 1.06012 -1.686996
[2,] 0.7135499 -0.4240688 1.565558 0.4376989 -0.3790441 1.06012 -1.686996
           [,8]      [,9]      [,10]     [,11]     [,12]   [,13]     [,14]
[1,] -0.6547972 0.1308809 -0.7629284 -1.499462 0.4944527 1.20236 -1.024953
[2,] -0.6547972 0.1308809 -0.7629284 -1.499462 0.4944527 1.20236 -1.024953
         [,15]    [,16]      [,17]    [,18]      [,19]      [,20]      [,21]
[1,] 0.5019482 1.846295 -0.9201675 1.798578 -0.1221087 -0.1675031 -0.2655928
[2,] 0.5019482 1.846295 -0.9201675 1.798578 -0.1221087 -0.1675031 -0.2655928
          [,22]     [,23]     [,24]       [,25]      [,26]     [,27]    [,28]
[1,] -0.2841026 -1.092556 -1.354065 -0.02356704 -0.1266447 0.6739003 1.806827
[2,] -0.2841026 -1.092556 -1.354065 -0.02356704 -0.1266447 0.6739003 1.806827
         [,29]      [,30]     [,31]     [,32]      [,33]    [,34]     [,35]
[1,] 0.4980001 -0.9994234 -1.493737 0.1947445 -0.3713602 1.057959 0.6059331
[2,] 0.4980001 -0.9994234 -1.493737 0.1947445 -0.3713602 1.057959 0.6059331
          [,36]    [,37]     [,38]      [,39]      [,40]       [,41]
[1,] -0.8115119 1.580788 0.9510683 -0.2867812 0.02992387 -0.04886932
[2,] -0.8115119 1.580788 0.9510683 -0.2867812 0.02992387 -0.04886932
           [,42]     [,43]      [,44]       [,45]     [,46]      [,47]
[1,] -0.09395709 0.5586359 -0.6477164 -0.04116704 0.4796192 -0.2351587
[2,] -0.09395709 0.5586359 -0.6477164 -0.04116704 0.4796192 -0.2351587
         [,48]       [,49]     [,50]      [,51]     [,52]     [,53]     [,54]
[1,] 0.7145843 -0.07355395 0.7760693 -0.4334906 -1.312099 0.3112813 -1.104964
[2,] 0.7145843 -0.07355395 0.7760693 -0.4334906 -1.312099 0.3112813 -1.104964
        [,55]     [,56]     [,57]     [,58]    [,59]      [,60]     [,61]
[1,] 1.099568 0.3647099 -0.880101 -1.497854 1.039762 -0.8746448 0.4943022
[2,] 1.099568 0.3647099 -0.880101 -1.497854 1.039762 -0.8746448 0.4943022
          [,62]     [,63]      [,64]     [,65]      [,66]     [,67]      [,68]
[1,] -0.1977673 0.1037893 -0.6327459 -1.345163 -0.4710217 0.1943071 -0.2663757
[2,] -0.1977673 0.1037893 -0.6327459 -1.345163 -0.4710217 0.1943071 -0.2663757
         [,69]     [,70]     [,71]       [,72]   [,73]     [,74]   [,75]
[1,] 0.7760879 0.8094611 -1.346667 -0.09629073 1.11061 -0.646885 1.07623
[2,] 0.7760879 0.8094611 -1.346667 -0.09629073 1.11061 -0.646885 1.07623
        [,76]     [,77]    [,78]      [,79]     [,80]     [,81]    [,82]
[1,] -1.07117 0.4429723 0.162385 -0.2446424 0.9306753 0.4508624 2.562772
[2,] -1.07117 0.4429723 0.162385 -0.2446424 0.9306753 0.4508624 2.562772
          [,83]     [,84]     [,85]      [,86]     [,87]      [,88]      [,89]
[1,] -0.5073439 -1.736795 0.4704589 -0.4860427 -1.165011 -0.9938444 -0.0321156
[2,] -0.5073439 -1.736795 0.4704589 -0.4860427 -1.165011 -0.9938444 -0.0321156
         [,90]    [,91]     [,92]      [,93]    [,94]     [,95]     [,96]
[1,] -1.568621 0.851293 0.1940642 -0.2036989 1.140328 0.5528641 0.7632381
[2,] -1.568621 0.851293 0.1940642 -0.2036989 1.140328 0.5528641 0.7632381
          [,97]     [,98]    [,99]    [,100]
[1,] -0.6089828 -1.092171 2.257834 0.3770677
[2,] -0.6089828 -1.092171 2.257834 0.3770677
> 
> 
> Max(tmp2)
[1] 2.407871
> Min(tmp2)
[1] -2.568567
> mean(tmp2)
[1] 0.1057972
> Sum(tmp2)
[1] 10.57972
> Var(tmp2)
[1] 1.169424
> 
> rowMeans(tmp2)
  [1]  0.874546410  0.385370845  0.981049393  1.208664609  1.752067551
  [6] -0.131165222 -0.693343692 -0.394158000 -0.742657752 -1.025351203
 [11]  1.760383120  0.916713332  0.628959189 -0.999107417  1.967018951
 [16]  0.044463240 -1.577406525  1.061391513  1.129387464 -0.874222747
 [21]  0.155780765  1.704330906  0.258132512 -1.561689729  0.375924717
 [26] -0.353939674 -0.634166243 -2.098810552  0.624531959  1.922843683
 [31] -1.297700950 -1.281141331  0.458506349 -1.792479584 -0.087474532
 [36]  1.647093189 -0.684860620  1.641686758  2.297655517  0.231019453
 [41]  0.814666363  0.026742825  0.609882628 -0.321463452 -0.319818469
 [46] -0.099193307  1.003253891  1.678353871  0.761561286  1.210062400
 [51]  1.468083360 -0.158774403 -0.395242929  0.099448144  0.649180843
 [56] -0.318683565  0.084145740 -0.063172408 -1.810723329 -1.668970430
 [61] -1.197231856  0.374858164 -1.463057858 -2.568567193  0.172885972
 [66] -0.901957036  0.783187017 -0.728038844  1.700498062 -0.061855350
 [71]  1.655590993  0.672812011  0.172091948  0.855859263  0.399813130
 [76]  2.407871116  0.933265946  0.186939074  0.331461612  0.008585435
 [81] -2.498229860  0.684669856 -0.910549018  0.196225252 -0.550558074
 [86]  0.595341210 -0.093830508 -0.403965132 -0.685437699 -1.166176600
 [91]  0.989145083  1.860153801  0.198476131  0.705638696 -0.612196765
 [96]  0.595435474 -0.464385266 -1.085752885 -0.969980551 -0.586501461
> rowSums(tmp2)
  [1]  0.874546410  0.385370845  0.981049393  1.208664609  1.752067551
  [6] -0.131165222 -0.693343692 -0.394158000 -0.742657752 -1.025351203
 [11]  1.760383120  0.916713332  0.628959189 -0.999107417  1.967018951
 [16]  0.044463240 -1.577406525  1.061391513  1.129387464 -0.874222747
 [21]  0.155780765  1.704330906  0.258132512 -1.561689729  0.375924717
 [26] -0.353939674 -0.634166243 -2.098810552  0.624531959  1.922843683
 [31] -1.297700950 -1.281141331  0.458506349 -1.792479584 -0.087474532
 [36]  1.647093189 -0.684860620  1.641686758  2.297655517  0.231019453
 [41]  0.814666363  0.026742825  0.609882628 -0.321463452 -0.319818469
 [46] -0.099193307  1.003253891  1.678353871  0.761561286  1.210062400
 [51]  1.468083360 -0.158774403 -0.395242929  0.099448144  0.649180843
 [56] -0.318683565  0.084145740 -0.063172408 -1.810723329 -1.668970430
 [61] -1.197231856  0.374858164 -1.463057858 -2.568567193  0.172885972
 [66] -0.901957036  0.783187017 -0.728038844  1.700498062 -0.061855350
 [71]  1.655590993  0.672812011  0.172091948  0.855859263  0.399813130
 [76]  2.407871116  0.933265946  0.186939074  0.331461612  0.008585435
 [81] -2.498229860  0.684669856 -0.910549018  0.196225252 -0.550558074
 [86]  0.595341210 -0.093830508 -0.403965132 -0.685437699 -1.166176600
 [91]  0.989145083  1.860153801  0.198476131  0.705638696 -0.612196765
 [96]  0.595435474 -0.464385266 -1.085752885 -0.969980551 -0.586501461
> 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.874546410  0.385370845  0.981049393  1.208664609  1.752067551
  [6] -0.131165222 -0.693343692 -0.394158000 -0.742657752 -1.025351203
 [11]  1.760383120  0.916713332  0.628959189 -0.999107417  1.967018951
 [16]  0.044463240 -1.577406525  1.061391513  1.129387464 -0.874222747
 [21]  0.155780765  1.704330906  0.258132512 -1.561689729  0.375924717
 [26] -0.353939674 -0.634166243 -2.098810552  0.624531959  1.922843683
 [31] -1.297700950 -1.281141331  0.458506349 -1.792479584 -0.087474532
 [36]  1.647093189 -0.684860620  1.641686758  2.297655517  0.231019453
 [41]  0.814666363  0.026742825  0.609882628 -0.321463452 -0.319818469
 [46] -0.099193307  1.003253891  1.678353871  0.761561286  1.210062400
 [51]  1.468083360 -0.158774403 -0.395242929  0.099448144  0.649180843
 [56] -0.318683565  0.084145740 -0.063172408 -1.810723329 -1.668970430
 [61] -1.197231856  0.374858164 -1.463057858 -2.568567193  0.172885972
 [66] -0.901957036  0.783187017 -0.728038844  1.700498062 -0.061855350
 [71]  1.655590993  0.672812011  0.172091948  0.855859263  0.399813130
 [76]  2.407871116  0.933265946  0.186939074  0.331461612  0.008585435
 [81] -2.498229860  0.684669856 -0.910549018  0.196225252 -0.550558074
 [86]  0.595341210 -0.093830508 -0.403965132 -0.685437699 -1.166176600
 [91]  0.989145083  1.860153801  0.198476131  0.705638696 -0.612196765
 [96]  0.595435474 -0.464385266 -1.085752885 -0.969980551 -0.586501461
> rowMin(tmp2)
  [1]  0.874546410  0.385370845  0.981049393  1.208664609  1.752067551
  [6] -0.131165222 -0.693343692 -0.394158000 -0.742657752 -1.025351203
 [11]  1.760383120  0.916713332  0.628959189 -0.999107417  1.967018951
 [16]  0.044463240 -1.577406525  1.061391513  1.129387464 -0.874222747
 [21]  0.155780765  1.704330906  0.258132512 -1.561689729  0.375924717
 [26] -0.353939674 -0.634166243 -2.098810552  0.624531959  1.922843683
 [31] -1.297700950 -1.281141331  0.458506349 -1.792479584 -0.087474532
 [36]  1.647093189 -0.684860620  1.641686758  2.297655517  0.231019453
 [41]  0.814666363  0.026742825  0.609882628 -0.321463452 -0.319818469
 [46] -0.099193307  1.003253891  1.678353871  0.761561286  1.210062400
 [51]  1.468083360 -0.158774403 -0.395242929  0.099448144  0.649180843
 [56] -0.318683565  0.084145740 -0.063172408 -1.810723329 -1.668970430
 [61] -1.197231856  0.374858164 -1.463057858 -2.568567193  0.172885972
 [66] -0.901957036  0.783187017 -0.728038844  1.700498062 -0.061855350
 [71]  1.655590993  0.672812011  0.172091948  0.855859263  0.399813130
 [76]  2.407871116  0.933265946  0.186939074  0.331461612  0.008585435
 [81] -2.498229860  0.684669856 -0.910549018  0.196225252 -0.550558074
 [86]  0.595341210 -0.093830508 -0.403965132 -0.685437699 -1.166176600
 [91]  0.989145083  1.860153801  0.198476131  0.705638696 -0.612196765
 [96]  0.595435474 -0.464385266 -1.085752885 -0.969980551 -0.586501461
> 
> colMeans(tmp2)
[1] 0.1057972
> colSums(tmp2)
[1] 10.57972
> colVars(tmp2)
[1] 1.169424
> colSd(tmp2)
[1] 1.081399
> colMax(tmp2)
[1] 2.407871
> colMin(tmp2)
[1] -2.568567
> colMedians(tmp2)
[1] 0.1639364
> colRanges(tmp2)
          [,1]
[1,] -2.568567
[2,]  2.407871
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.5189918 -3.9418032  1.9084090  4.0275148  2.1205116 -4.4955287
 [7]  3.8411284  3.4182901 -2.0777827  0.2510892
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9322848
[2,] -0.6140034
[3,] -0.1742893
[4,]  0.6171259
[5,]  2.3700191
> 
> rowApply(tmp,sum)
 [1]  0.03402486  4.26790332 -3.40763628  6.05115997  1.53753642 -0.88196968
 [7]  5.66949129  1.62177602 -5.62574453 -2.69572093
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    4    8    7   10    3   10    4    4     5
 [2,]    8    5    5    3    3   10    1    1    1     2
 [3,]    3    3    6    4    6    6    8    8    5     8
 [4,]   10    7    7    9    2    9    6    3    8     7
 [5,]    2    9    3    2    8    2    2    6   10     9
 [6,]    1    2    9    1    1    1    7    7    3     6
 [7,]    5    6   10    5    5    4    5    9    6    10
 [8,]    6    8    4    8    4    5    4   10    2     4
 [9,]    7    1    2    6    9    8    9    5    7     1
[10,]    9   10    1   10    7    7    3    2    9     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.8020290  3.1324077 -3.2305682  5.4197476 -1.2253614  1.0053361
 [7] -2.5469034 -1.6832253  1.5823399  2.2039316 -0.1375585 -1.7659818
[13] -2.5538808  4.0283909  0.1032667  4.7759057 -1.4866193 -4.2831209
[19]  0.2905197  0.4732657
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.3341528
[2,] -0.1183944
[3,]  0.1120219
[4,]  0.4055470
[5,]  0.7370072
> 
> rowApply(tmp,sum)
[1] -0.3564578 -1.8673730  0.3781539  2.4218471  4.3277506
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11   15   10    7   12
[2,]   15   12   17   13   18
[3,]   10    3    8    6    4
[4,]   14   17   19   16   14
[5,]   16    2   13   10    7
> 
> 
> as.matrix(tmp)
           [,1]      [,2]       [,3]      [,4]        [,5]       [,6]
[1,]  0.1120219 0.5033850 -0.0348859 0.4375832  0.60730054 -0.7050415
[2,]  0.7370072 0.2318722 -1.2307875 1.0297883 -1.54740294  1.0645092
[3,] -0.3341528 1.0231442 -0.6985279 2.4077754 -0.06405069 -0.1113077
[4,] -0.1183944 0.3112147 -0.2644713 1.0037900  0.04245246  1.0634218
[5,]  0.4055470 1.0627915 -1.0018955 0.5408107 -0.26366081 -0.3062457
           [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,] -0.9728742 -0.7951347  1.0267846 0.698978956  0.3638295 -0.5277074
[2,]  0.7278093 -0.6046639 -1.0082832 0.002294644 -1.1792151  0.5649295
[3,] -1.1374449  0.8966677 -1.0061178 0.891130588 -0.8424923 -0.9360657
[4,] -0.7039640 -2.2352980  2.3191260 0.260679002  1.1446922 -1.5571564
[5,] -0.4604296  1.0552034  0.2508302 0.350848453  0.3756272  0.6900181
           [,13]       [,14]      [,15]      [,16]       [,17]       [,18]
[1,]  0.12923747  1.02089246 -0.3642691 -0.6244821 -0.19062581 -0.98811933
[2,] -0.49070214  1.16429912  0.8157482  1.3900910  0.08313939 -0.02353339
[3,] -0.97578656  1.11417053 -0.8928007  0.3954635 -0.43080932 -1.47379282
[4,] -0.08364712 -0.05056194  0.1389791  1.2373383  0.93722920 -0.60414681
[5,] -1.13298240  0.77959073  0.4056092  2.3774949 -1.88555273 -1.19352852
          [,19]       [,20]
[1,] -1.1273357  1.07400413
[2,] -2.5507050 -1.04356802
[3,]  2.6358322 -0.08268102
[4,] -0.7496282  0.33019255
[5,]  2.0823565  0.19531804
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-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:    /home/biocbuild/bbs-3.20-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.14581 -0.9449052 -1.488527 0.04509522 0.08377078 -0.06878277 -0.2829624
          col8       col9    col10      col11     col12      col13     col14
row1 0.1930403 -0.4219259 -0.92881 0.09869351 0.6019794 -0.1985988 0.1114748
          col15     col16    col17     col18     col19       col20
row1 -0.9886464 -1.141287 1.639117 -1.051711 -1.523576 -0.04850908
> tmp[,"col10"]
           col10
row1 -0.92881002
row2 -1.65068787
row3 -0.02951375
row4 -0.59805831
row5 -0.75148157
> tmp[c("row1","row5"),]
          col1       col2      col3       col4       col5        col6
row1 -1.145810 -0.9449052 -1.488527 0.04509522 0.08377078 -0.06878277
row5  1.064542  2.0366758  1.356440 0.07713771 0.84029629 -0.61990476
           col7      col8       col9      col10      col11      col12
row1 -0.2829624 0.1930403 -0.4219259 -0.9288100 0.09869351  0.6019794
row5  0.5515710 0.2898213 -0.2972257 -0.7514816 0.24005795 -0.2479326
          col13      col14      col15       col16      col17     col18
row1 -0.1985988  0.1114748 -0.9886464 -1.14128655  1.6391174 -1.051711
row5 -2.1247561 -0.6369654  0.3796694  0.07436444 -0.2813172 -1.698730
          col19       col20
row1 -1.5235756 -0.04850908
row5 -0.6255938  0.94099251
> tmp[,c("col6","col20")]
            col6       col20
row1 -0.06878277 -0.04850908
row2 -0.69189599 -1.11593182
row3  0.61767391  0.39020504
row4 -0.57033154 -0.46584329
row5 -0.61990476  0.94099251
> tmp[c("row1","row5"),c("col6","col20")]
            col6       col20
row1 -0.06878277 -0.04850908
row5 -0.61990476  0.94099251
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.07329 50.66396 50.40452 50.19818 50.03059 106.3719 51.42987 50.61503
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.93781 47.76167 49.25001 50.87474 49.10511 50.47196 51.00927 49.82769
        col17    col18    col19    col20
row1 49.17537 49.49881 50.19683 103.3815
> tmp[,"col10"]
        col10
row1 47.76167
row2 29.12288
row3 29.41792
row4 29.80148
row5 49.48397
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.07329 50.66396 50.40452 50.19818 50.03059 106.3719 51.42987 50.61503
row5 48.26567 49.10685 50.41500 50.04762 51.35151 105.6827 50.69846 50.49467
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.93781 47.76167 49.25001 50.87474 49.10511 50.47196 51.00927 49.82769
row5 50.27258 49.48397 51.89025 49.44865 48.55005 50.46084 50.72168 49.85643
        col17    col18    col19    col20
row1 49.17537 49.49881 50.19683 103.3815
row5 49.88354 50.00427 49.51978 104.1065
> tmp[,c("col6","col20")]
          col6     col20
row1 106.37193 103.38155
row2  75.63105  75.63296
row3  73.89535  76.01057
row4  75.02472  74.13434
row5 105.68268 104.10647
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.3719 103.3815
row5 105.6827 104.1065
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.3719 103.3815
row5 105.6827 104.1065
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.9138745
[2,] -0.2647402
[3,] -0.1808509
[4,] -0.5973214
[5,]  0.4786659
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.3223363 -1.6785239
[2,] -0.1370587 -0.7264519
[3,]  0.5609418 -0.8976143
[4,]  0.2230693 -0.6381543
[5,]  0.3256787 -0.3577095
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
          col6      col20
[1,] 0.3879093  0.3014641
[2,] 0.9972987  0.9348224
[3,] 0.3464088 -0.9722929
[4,] 0.2072140  1.2604038
[5,] 2.4263016  0.6050679
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.3879093
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.3879093
[2,] 0.9972987
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
            [,1]      [,2]       [,3]       [,4]      [,5]       [,6]
row3  0.04394579 -0.168838 -0.1125902 -0.8907502 -1.739166 -0.8157974
row1 -0.73198653 -1.157386  0.2189898  0.3476206  1.452417 -0.2292160
           [,7]       [,8]       [,9]    [,10]      [,11]     [,12]      [,13]
row3  0.4470057 -0.3706429  0.6908462 1.472623 -0.7053339 0.6339252 -0.7339346
row1 -0.5810141  0.8422867 -0.9116364 0.323044 -0.2250271 0.9270681 -0.2169924
          [,14]     [,15]     [,16]     [,17]      [,18]    [,19]      [,20]
row3  1.2009764 1.6813216 0.5725456 1.5028694 -0.4435314 1.311552 -1.2078781
row1 -0.1463845 0.1969614 1.4279267 0.1509327  0.2361629 1.095110  0.7326315
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]       [,3]      [,4]      [,5]       [,6]     [,7]
row2 -1.059284 2.455392 -0.7053851 0.4007506 -1.068066 -0.6216058 1.292686
           [,8]        [,9]     [,10]
row2 0.06426854 -0.06515555 -2.087553
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]      [,3]       [,4]     [,5]      [,6]      [,7]
row5 -0.5629334 -1.279904 0.6123316 -0.9822183 1.547063 0.2047645 -0.211292
          [,8]     [,9]      [,10]    [,11]    [,12]     [,13]    [,14]
row5 -1.650604 1.116398 -0.3463651 1.075844 1.001142 -1.257458 1.855337
          [,15]    [,16]     [,17]     [,18]      [,19]      [,20]
row5 0.05020951 0.648302 0.1727949 0.4129978 -0.7629015 -0.7507707
> 
> 
> 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: 0xc9642f0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda61497ebd8"
 [2] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda610fc89a6"
 [3] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda63ef005d3"
 [4] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda64ed7758e"
 [5] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda62909b109"
 [6] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda670978a4c"
 [7] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda663073bc3"
 [8] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda6749f35d3"
 [9] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda637e570f3"
[10] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda636351aaa"
[11] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda6285f582f"
[12] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda641f4076f"
[13] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda67e2a26c1"
[14] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda620c1b50f"
[15] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMcbda67a457d7e"
> 
> 
> ### 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: 0xb4a55d0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xb4a55d0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xb4a55d0>
> rowMedians(tmp)
  [1] -0.047180989  0.190968111  0.264847533 -0.095656426 -0.590129742
  [6] -0.129658549  0.021370158  0.426150484  0.162990544  0.152436225
 [11]  0.144304271 -0.211381912 -0.383538818  0.338679687  0.398673646
 [16]  0.100928902  0.078579763  0.174035667  0.077959177  0.212205725
 [21] -0.446313850 -0.427038372 -0.357304200 -0.086697225 -0.144814056
 [26]  0.409457100 -0.428194825  0.002773594 -0.309130421 -0.069361783
 [31] -0.808103867  0.228874400 -0.475305112 -0.091245327  0.383620686
 [36] -0.202765278 -0.408774003  0.444169857 -0.133913946 -0.015531990
 [41]  0.107267390  0.165373876 -0.416551333 -0.162214931 -0.352450286
 [46]  0.006563975 -0.066951450  0.379493066 -0.078474978  0.299749665
 [51]  0.565470197 -1.049713225 -0.024329033 -0.171486563 -0.004072087
 [56]  0.038017250 -0.377233977  0.317464129  0.030165383  0.211278277
 [61] -0.022002975  0.261317642 -0.424221175 -0.357785311  0.180843411
 [66]  0.052397131  0.409774329 -0.162077654 -0.187768474  0.004469668
 [71] -0.452656432  0.337183969  0.213935715  0.529143071 -0.033843960
 [76]  0.425293081 -0.558626935  0.029774725 -0.084587372 -0.621422360
 [81]  0.324619363  0.776459265 -0.239926534  0.228774619  0.207462066
 [86] -0.254556277 -0.753726479 -0.201525716  0.032690222 -0.463435782
 [91] -0.195121456 -0.212817491 -0.079328723  0.140074728 -0.283467302
 [96]  0.041629732  0.098820572 -0.325965344 -0.341960857  0.036778582
[101]  0.272545988 -0.492534047 -0.086130214 -0.147757569 -0.347016445
[106] -0.211762931 -0.013704234  0.003549650  0.175352157  0.307246369
[111]  0.300436513  0.541235363  0.129845606  0.299969918  0.565603132
[116]  0.039608097  0.185617854 -0.204859075  0.620500828  0.147446460
[121]  0.471117873 -0.049874482  0.280296466 -0.042739781 -0.543726432
[126] -0.646906555  0.124971537  0.466431161 -0.333969474  0.396614174
[131]  0.433498838  0.006616274  0.207589477 -0.223061666  0.626742598
[136] -0.140973744  0.053687784  0.104262087 -0.119465668  0.226733957
[141] -0.324302371  0.247330266  0.298443345 -0.543541764 -0.247869702
[146] -0.338372882  0.061204200 -0.534116097 -0.202016712 -0.018639385
[151] -0.356089516 -0.195999095  0.456009013 -0.332347290  0.116386717
[156]  0.103776942  0.121171996  0.121159070 -0.556398568  0.558458230
[161]  0.476850899  0.107157937 -0.358632995 -0.323888666  0.074054637
[166]  0.080427875 -0.007015493  0.405586619  0.477768324  0.211648356
[171] -0.110452608 -0.001335742 -0.279877023 -0.176125851  0.386739434
[176] -0.030070174  0.047832150  0.613922879 -0.131346759  0.023041901
[181] -0.559499804 -0.110239139 -0.081967659 -0.075679753  0.237818326
[186]  0.088695401  0.018433150 -0.458187834 -0.496792842 -0.188821638
[191]  0.600097900  0.422620742 -0.205471897 -0.451208077  0.264391371
[196] -0.372788173 -0.139986371  0.083189595 -0.445052230 -0.385588546
[201] -0.250649613  0.217693839 -0.153546707 -0.430631147 -0.075042225
[206] -0.323200628 -0.577523962 -0.208982077 -0.337273016  0.343449983
[211] -0.037767189 -0.103852054 -0.450110803  0.273522540 -0.514698423
[216] -0.021365834 -0.226316200 -0.186715293 -0.859859292  0.275729943
[221]  0.438942464 -0.335331095  0.120364697  0.957936593  0.277424014
[226]  0.136118967 -0.205160984  0.401116117  0.525925249 -0.542871849
> 
> proc.time()
   user  system elapsed 
  2.006   0.829   2.855 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x35ef2f80>
> .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: 0x35ef2f80>
> .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: 0x35ef2f80>
> .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: 0x35ef2f80>
> 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: 0x35be1c60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35be1c60>
> .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: 0x35be1c60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35be1c60>
> .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: 0x35be1c60>
> 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: 0x35d68e40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35d68e40>
> .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: 0x35d68e40>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x35d68e40>
> .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: 0x35d68e40>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x35d68e40>
> .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: 0x35d68e40>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x35d68e40>
> .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: 0x35d68e40>
> 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: 0x35abb550>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x35abb550>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35abb550>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35abb550>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilecbdd8180afa76" "BufferedMatrixFilecbdd85f15160e"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilecbdd8180afa76" "BufferedMatrixFilecbdd85f15160e"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x36959e00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x36959e00>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x36959e00>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x36959e00>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x36959e00>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x36959e00>
> .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: 0x369577f0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x369577f0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x369577f0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x369577f0>
> 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: 0x367fc130>
> .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: 0x367fc130>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.331   0.051   0.364 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

Example timings