solve()函数冻结GNU R 3.6.3中的CLI



(从AskUbuntu交叉发布:https://askubuntu.com/questions/1230138/cannot-use-the-solve-function-in-gnu-r-with-ubuntu-20-04(

我不能在GNU R中使用solve((函数。具体来说,每当我试图使用所述函数反转矩阵时,控制台都会挂起。下面我将详细解释这种情况。

考虑代码

D = matrix(
data = c(1, 2, 3, 4),
nrow = 2,
ncol = 2,
byrow = TRUE
)
solve(D)
  1. 如果我在R中启动从终端调用的代码,比如Konsole,会话将冻结。
    • 我知道系统冻结的确切时间是当我执行solve((函数时
    • 根据htop的说法,当这种情况发生时,我的一个CPU核心被100%使用
  2. 如果我在RStudio中启动相同的代码,代码将按预期工作。但是,如果我使用RStudio内部的终端调用它,会话将挂起。
    • 如果在RMarkdown文档中使用solve((函数,则会话将冻结,并且不会生成文档
  3. 使用--vanilla启动R并不能解决问题
  4. 重新启动电脑,使用我的外部图形卡,在apt中重新安装基于r的核心软件包,并尝试使用不同的终端模拟器都无济于事
  5. 从R中的solve((函数的文档中可以看出,solve(A,B(实际上有两个自变量:A是矩阵,B是向量或矩阵。如果B是向量,它求解线性系统Ax=B。如果B是矩阵,它求解Ax=B并返回X。如果第二个参数中没有给出任何内容,它会自动假设适当大小的单位矩阵为B。求解线性系统的第一个函数起作用然而,如果我指定矩阵作为第二个参数,同样的问题也会发生
  6. 将QR分解与QR.solve(A(结合使用仍然效果良好

以下是我的问题:

  1. 有人和我有同样的问题吗
  2. 我还寻求关于如何解决这个问题的建议

供您参考,我使用的是从默认apt存储库安装的R 3.6.3版本。

感谢您的阅读,并保持安全!


AskUbuntu的N0rbert给了我以下回复:

我无法在干净的20.04 LTS VM上进行复制。请参阅我的复制步骤-
pastebin.com/R7JhkYJT。在您的机器上执行它并共享输出。还将哪个R和R-版本的输出添加到问题主体中。

从可执行的bash脚本文件中执行N0rbert的代码,会话将挂在solve(D(。

kobyeongmin@odie:~/Temp$ ./r-test.sh 
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
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.
Natural language support but running in an English locale
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.
> D = matrix(
+ data = c(1, 2, 3, 4),
+ nrow = 2,
+ ncol = 2,
+ byrow = TRUE
+ )
> solve(D)

此外,这里是R和R的输出——版本:

kobyeongmin@odie:~$ which R
/usr/bin/R
kobyeongmin@odie:~$ R --version
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

我收到了来自R-help邮件列表的宝贵帮助。这是由于libopenblas0 pthread包中的一个错误造成的,可以通过删除libopenblas pthread devlibopenblas5 pthread并安装

libopenblas openmp dev有关更多信息,请参阅5月初左右的R-help邮件列表和debian科学列表:https://lists.debian.org/debian-science/2020/04/msg00081.html

最新更新