This function implements a simple cache-oblivious algorithm for the transposition of a Filebacked Big Matrix.

big_transpose(X, backingfile = tempfile(tmpdir = getOption("FBM.dir")))

Arguments

X

An object of class FBM.

backingfile

Path to the file storing the Big Matrix on disk. An extension ".bk" will be automatically added. Default stores in the temporary directory.

Value

The new transposed FBM. Dimensions and type are automatically determined from the input FBM.

Examples

X <- FBM(6, 5, init = rnorm(30))
X[]
#>            [,1]         [,2]       [,3]       [,4]       [,5]
#> [1,]  0.1066472 -0.350078968  0.3014073  1.6228060  1.3485703
#> [2,] -1.0103989  1.681213501 -1.6633137  0.8911158  0.1358977
#> [3,]  1.1788924 -2.290655613 -0.4913255 -0.5310150  1.5544532
#> [4,] -1.8382279 -0.004754315 -0.3598196  1.0204832 -0.1388967
#> [5,] -1.2122184 -1.556176609  1.6691504  1.1152850 -0.1206802
#> [6,] -0.7722889  0.699863428  0.9413492  0.1955967  0.7522782
Xt <- big_transpose(X)
identical(t(X[]), Xt[])
#> [1] TRUE