我有一個矩陣B.錯誤'Out of memory'是什麼原因?
dim(B)
> 3025 3025
當我嘗試使用這個矩陣,以創建我收到錯誤的圖形對象:
library(igraph)
g <- graph.adjacency(B, weighted=TRUE, mode="undirected", diag=FALSE)
# Error in .Call("R_igraph_weighted_adjacency", adjmatrix,
# as.numeric(mode), :
# At vector.pmt:439 : cannot reserve space for vector, Out of memory
什麼是錯誤的原因是什麼?這是R還是我的電腦的限制?
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows Vista (build 6001) Service Pack 1
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] igraph_1.0.1
更新(@Gabor意見後)。 我試圖重現錯誤。我用過:
B <- matrix(runif(3025*3025, 0, 10), nc = 3025)
#Error: cannot allocate vector of size 69.8 Mb
g <- graph.adjacency(B, weighted=TRUE, mode="undirected", diag=FALSE)
object.size(B)
#73423056 bytes
object.size(g)
#395900 bytes
但是錯誤是不一樣的。該錯誤是在庫(igraph)調用函數之前發生的。然後我寫了
B<-c()
>B
NULL
B <- matrix(runif(3025*3025, 0, 10), nc = 3025)
g <- graph.adjacency(B, weighted=TRUE, mode="undirected", diag=FALSE)
Error in .Call("R_igraph_weighted_adjacency", adjmatrix, as.numeric(mode), :
At vector.pmt:439 : cannot reserve space for vector, Out of memory
dim(B)
#[1] 3025 3025
object.size(B)
#73205112 bytes
object.size(g)
#395900 bytes
Windows Vista的問題? 32位問題? B < - 矩陣(樣本(0:1,9150625,替換= TRUE,概率= c(0.9,0.1)),nc = 3025)。 graph.adjacency(B,weighted = TRUE,mode =「undirected」,diag = FALSE)在64位Linux上運行。 'B'裏面有什麼? – 2016-02-05 04:05:35
在我的機器上,我正在看它。它使用43GB的RAM來計算。然後60GB。我認爲這是針對較小的數據集。 –
@BrandonBertelsen您可以分享您的代碼片段嗎?我發表評論時看不到這樣的高峯。 – 2016-02-05 04:09:19