[R] solve() function freezes CLI in GNU R 3.6.3

J C Nash pro|jcn@@h @end|ng |rom gm@||@com
Sat May 9 17:40:32 CEST 2020


I get the output at the bottom, which seems OK.

Can you include sessionInfo() output?
Possibly this is a quirk of the particular distro or machine, BLAS or LAPACK,
or something in your workspace. However, if we have full information, someone may be
able to run the same setup in a VM (if I have the .iso and can find
a way to set up R 3.6.3 easily, I'll be willing). It may be that you should
reinstall libblas or liblapack as one thing to try.

JN

Here's my output:

> D = matrix(
+ data = c(1, 2, 3, 4),
+ nrow = 2,
+ ncol = 2,
+ byrow = TRUE)
> solve(D)
     [,1] [,2]
[1,] -2.0  1.0
[2,]  1.5 -0.5
> D %*% solve(D)
     [,1]         [,2]
[1,]    1 1.110223e-16
[2,]    0 1.000000e+00
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.3

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.0.0
>

On 2020-05-09 5:45 a.m., ‍고병민[ 학부재학 / 경제학과 ] wrote:
> Dear list,
> 
> there is a bug with the *solve() *function that I cannot find a solution
> for a month. So I ask for your help.
> 
> *Whenever I try to invert a matrix using the said function, the console
> hangs*.
> Below I explain more about this situation.
> 
> Consider the code
> 
> D = matrix(
> data = c(1, 2, 3, 4),
> nrow = 2,
> ncol = 2,
> byrow = TRUE)
> solve(D)
> 
> 1. *If I launch the code in R called from a terminal, say, Konsole, the
> session will freeze.*
>   * I know that the exact timing of the system freeze is when I execute the
> solve( ) function.
>   * According to htop, one of my CPU core is used by 100% when this happens.
> 
> 2. *If I launch the same code within RStudio, the code works as expected.*
> However, if I call it using the terminal inside RStudio, the session hangs.
>   * If the solve() function is used within RMarkdown document, the session
> will freeze and the document will not be generated.
> 
> 3. Launching R with --vanilla does not resolve the issue.
> 
> 4. Rebooting the PC, using my external graphic card, reinstalling the
> r-base-core package in apt, and trying with different terminal emulators do
> not help.
> 
> 5. From the documentation of the solve( ) function in R, it can be seen
> that solve(A, B) actually takes two arguments: A is a matrix, and B a
> vector or a matrix. If B is a vector, it solves the linear system Ax = B.
> If B is a matrix, it solves AX = B and returns X. If nothing is given in
> the second argument, it automatically assumes identity matrix of
> appropriate size as B. **The first function of solving linear system
> works.** If I specify matrices as the second argument, however, the same
> problem happens.
> 
> 6. Using QR decomposition with qr.solve(A) still works well.
> 
> Here are my questions:
> 
> *1. Has anyone had the same problem as me?*
> *2. I also seek recommendations on how to fix this issue.*
> 
> For your information, I am using R version 3.6.3 installed from the default
> apt repository. Here is the output of which R and R -- version:
> 
>     kobyeongmin using odie:~$ which R
>     /usr/bin/R
> 
>     kobyeongmin using 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/.
> 
> Thank you for reading this, and stay safe!
> 
> Best regards
> 
> Ko Byeongmin
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list