[Rd] external BLAS library triggering erroneous ill-condtionned matrices

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Fri Oct 30 17:07:57 CET 2026


>>>>> Dirk Eddelbuettel 
>>>>>     on Thu, 29 Oct 2026 07:41:19 -0500 writes:

    > On 29 October 2026 at 10:02, bastien_chassagnol--- via R-devel wrote:
    > | Set-up: R 4.6.1 (Ubuntu 22.04 build), linked to the system OpenBLAS

    > That's dated / a mismatch.  Why current R but older BLAS/LAPACK?  I recommend
    > Ubuntu 26.04 or 26.10 if you want to engage with upstream.

    > It's also ... sort-of well known. 

Well, yes - as e.g., I knew about such problems and I think have
written here ("R-devel mailing list" or "R-devel" or "R-help")
probably more than once.

Still most useRs do *not* know about such problems.

Also, I'm glad for Bastien's example
      -- yes, please make it available electronically! -- 
because what he describes is much more severe than I'd have
expected, the matrix so far away from singular {judged from the eigen values}.
More (or 'much more') revealing should be to see the condition number(s):
Bastien, can you please also report

  kappa(<matrix>)

and/or

  rcond(<matrix>)

maybe  kappa(*, exact=TRUE, norm="")
or use {what I have added to the base/man/kappa.Rd  examples now in R-devel}

kappasX <- function(x, inv = solve(x))
   vapply(c("M","2","1","F"), # NB:  'O' = 'I' = '1'
          \(nrm) kappa(x, exact=TRUE, norm=nrm, inv_z=inv), 1.2)

to apply to your matrix?

Best regards,
Martin

    > Just rotate through the available BLAS /
    > LAPACK combinations. On a Debian / Ubuntu system is so easy that many (many)
    > years ago I wrote a package doing just that to compare and time with GPUs,
    > see https://cran.r-project.org/package=gcbd -- could use some love and an
    > update to current packages.

    > There is also flexiblas, already in Fedora and last I checked 'being
    > packaged' for Debian.

    > | The reference libraries were loaded with `LD_PRELOAD`; the kernel was set

    > You don't need to do that. `gcbd` just uninstall / reinstalls. If you check
    > the manual page, you can see how the `update-alternatives` command (a Debian
    > / Ubuntu special) allows you to switch.  The number of available BLAS /
    > LAPACK varies from year to year but there are way more than just reference
    > BLAS and OpenBLAS. On my (26.04) machine just now

    > $ apt-cache search libblas | wc -l
    > 33
    > $ 
    > $ apt-cache search libblas | grep -- -dev | wc -l
    > 16
    > $ 

    > It's big topic, and if you check source (of e.g. R itself) you will often
    > find comments about precision varying. "Practical" numerical analysis has
    > challenges that more theoretical approaches may gloss over.

    > Dirk

    > -- 
    > dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org

    > ______________________________________________
    > R-devel using r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list