Just an FYI that on my system identical(e1,e2) returns TRUE. Here is the output of sessionInfo() on my system:
> sessionInfo() R version 4.4.2 (2024-10-31) Platform: x86_64-pc-linux-gnu Running under: Ubuntu 22.04.5 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: Asia/Jerusalem tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices datasets utils methods base loaded via a namespace (and not attached): [1] compiler_4.4.2 tools_4.4.2 bspm_0.5.7 HTH, Eric On Sun, May 4, 2025 at 8:28 PM peter dalgaard <pda...@gmail.com> wrote: > Have you looked more closely at the differences? Eigenvectors are only > determined up to a sign change, so different platforms often give results > that differ by sign. If you use a multitasking numerical library, the same > can happen within platform because the exact sequence of computations > differs between calls. > > You could check > > a) that e1$values and e2$values are the same > b) that the crossprod(e1$vectors, e2$vectors) is a diagonal matrix with 1 > or -1 in the diagonal. (This might fail if you have eigenvalues that are > almost identical, though.) > > -pd > > > On 4 May 2025, at 17.57, smallepsilon via R-help <r-help@r-project.org> > wrote: > > > > I am using MKL with R 4.5.0 on Linux, and eigen() is producing different > results with identical calls. Specifically, when I run the code below, I > get "FALSE" from identical(). Just in case it had something to do with a > random number generator, I put identical set.seed() calls immediately > before each eigen() call, but that did not help. Has anyone seen this > behavior before? > > > > (When n is 5, the identical() call almost always returns "TRUE". As n > increases, the proportion of FALSE results increases, and it is nearly > always FALSE when n is 50.) > > > > Jesse > > > > *** > > > > n <- 50 > > set.seed(20250504) > > Sigma <- rWishart(1, df = n, Sigma = diag(n))[,,1] > > e1 <- eigen(Sigma) > > e2 <- eigen(Sigma) > > identical(e1, e2) > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business SchoolSolbjerg Plads 3, 2000 > Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd....@cbs.dk Priv: pda...@gmail.com > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.