																-*-markdown-*-
The Fortran routines here were extracted from LAPACK 3.1.0, then
3.1.1, 3.4.1, 3.4.2, 3.5.0, 3.6.0, 3.6.1, 3.7.0, 3.7.1, 3.8.0, 3.9.0,
3.10.0 3.10.1 3.11.0 3.12.0 3.12.1
(Sources from https://www.netlib.org/lapack and mirrors).

dlapack.f contains support routines for `real' LAPACK calls.
cmplx.f contains support routines for LAPACK calls from complex
arithmetic routines, that are only used if COMPLEX*16 is supported by
the Fortran compiler and compatible with the Rcomplex type.
Neither will be compiled if an external LAPACK is used.

We have tried to avoid including any single-precision routines.


Preparation
-----------

For 3.11.0 SRC/dlatrs.f needed patching for gfortran 12: see R.patch.
No longer needed for 3.12.0.

The original release of 3.12.1 had the wrong version in llaver.f and
needs ediitng.

dlapack.f and cmplx.f were created at the top level in the LAPACK
3.x.y sources by copying {dble,cmplx}.txt there and running in R

```{r}
dir.create('dble')
foo <- scan('dble.txt', "")
file.copy(file.path("SRC", foo), 'dble')
file.copy(file.path("INSTALL", 'ilaver.f'), 'dble')
system('cpp SRC/iparam2stage.F > dble/iparam2stage.f') ## may give warnings
Sys.setlocale("LC_COLLATE", "C")
## system("cat dble/* > dlapack.f") #-- a version that *sorts* correctly:
system(paste("cat", paste0(list.files("dble", full.names=TRUE), collapse=" "), "> dlapack.f"))

dir.create('cmplx')
foo <- scan('cmplx.txt', "")
table( file.copy(file.path("SRC", foo), 'cmplx') ) # all TRUE !?
Sys.setlocale("LC_COLLATE", "C")
## system("cat cmplx/* > cmplx.f") #-- a version that *sorts* correctly:
system(paste("cat", paste0(list.files("cmplx", full.names=TRUE), collapse=" "), "> cmplx.f"))
```

Then in the terminal

	cat INSTALL/droundup_lwork.f >> dlapack.f

If you update the LAPACK version, you need to copy over the LICENSE
file and update it in doc/COPYRIGHTS.  And if you patch the sources,
*DO* mention it here and add the patch to a file R.patch.

la_xisnan.f90 was created by

	cpp SRC/la_xisnan.F90 > la_xisnan.f90

New LAPACK versions (even point releases) often add new auxiliary
routines, and these can be hard to track down.  We found it helpful to
compare the outputs of

	nm -g dlapack.o | grep ' T ' | cut -b20-
	nm -g dlapack.o | grep ' U ' | cut -b20-

before and after updating (ditto for cmplx.o).  (This may need
adjusting for your platform's nm.)

Lnx Fedora 38 (2024-02-06), for `cmplx.o`; old version renamed to `complx.o_1`:
```{sh}
 nm -g cmplx.o   | grep ' U ' | cut -b20- > cmplx_U_new
 nm -g cmplx.o   | grep ' T ' | cut -b20- > cmplx_T_new
 nm -g cmplx.o_1 | grep ' T ' | cut -b20- > cmplx_T_1
 nm -g cmplx.o_1 | grep ' U ' | cut -b20- > cmplx_U_1
 diff cmplx_U_1 cmplx_U_new
 ## shows newly needed auxiliary routines - incl one from BLAS (which needs *no* action)
 diff cmplx_T_1 cmplx_T_new
 ## shows the newly added routines (by yourself, i.e., via cmplx.txt)
```


History
-------

zlahr2 zlaqr0 zlaqr1 zlaqr2 zlaqr3 zlaqr4 zlaqr5 zlartg zpotf2 zpotrf
zrot ztrexc
were added in R 2.5.0.

izmax1 zdrscl zgecon zlacn2 zlantr ztrcon
were added in R 2.7.0.

dzsum1 ilazlc ilazlr zunmhr
were added in R 2.15.2.

zgelsd zgesdd zlacp2 zlacrm zlals0 zlalsa zlalsd zlarcm
were added in R 3.1.0.

zgeequ zgees zgels zgerfs zgesc2 zgesvx zgetc2 zgetri zggbak zggbal
zgges zggev zgghrd zheevd zhgeqz zlaed0 zlaed7 zlaed8 zlaqge zlasyf
zlatdf zlauu2 zlauum zpotri zstedc zsymv zsyr zsytf2 zsytrf zsytri
ztgevc ztgex2 ztgexc ztgsen ztgsy2 ztgsyl ztrsen ztrsyl ztrti2 ztrtri
zunm2l zunmql zunmtr
were added in R 3.3.0 for use by a CRAN package.

dbdsvdx dgesvdx dgetrf2 dgges3 dggev3 dgghd3 dggsvd3 dggsvp3 dorm22 dpotrf2
zgetrf2 zpotrf2
were new in LAPACK 3.6.0 and added in R 3.3.0.

dtrevc3 and ztrevc3 were new in LAPACK 3.6.1 and added in R 3.4.0.

dcombssq.f was patched in R 3.6.3 (see the R-admin manual): that patch
is now in the main distribution.

Patches from LAPACK 3.9.0 to 3.10.0 were applied for R 4.2.0 but not
the new .f90 files replacing dlartg.f dlassq.f zlartg.f zlassq.f

Those 4 routines were replaced by their .f90 versions in R 4.3.0.

### R 4.2.2 added

zgbcon zgbequ zgbrfs zgbsv zgbsvx zgbtf2 zgbtrf zgbtrs zgeevx zgtcon
zgtrfs zgtsv zgtsvx zgttrf zgttrs zgtts2 zlagtm zlangb zlangt zlansy
zlantb zlaqgb zlaqhe zlatbs zpbtf2 zpbtrf zpocon zpoequ zporfs zposv
zposvx zpotrs zpstf2 zpstrf ztrsna

for recent RcppArmadillo with LLVM clang 15.

### R 4.4.0 added

zrscl needed for zgetf2 in 3.12.0

zlansp zlantp zlatps zppcon zpptrf zpptri zpptrs zspcon
zspr zsptrf zsptri zsptrs zsycon zsytrs ztpcon ztptri ztptrs
zhecon zhetrf zhetri zhetrs
zhpcon zhptrf zhptri zhptrs zlanhp

plus   zspmv   for BLAS

at the request of the Matrix maintainers

### R 4.5.0 added

dlarf1f dlarf1l zlarf1f zlarf1l added for 3.12.1

and dgemmtr and zgemmtr to BLAS.  These have not been added to 
src/incclude/R_ext/{BLAS,LAPACK}.h


We still include the deprecated (in LAPACK 3.6.0) subroutines in files
DEPRECATED/dgegv.f DEPRECATED/dgeqpf.f DEPRECATED/dggsvd.f DEPRECATED/dggsvp.f
DEPRECATED/dgegs.f DEPRECATED/dgelsx.f DEPRECATED/dlahrd.f DEPRECATED/dlatzm.f
DEPRECATED/dtzrqf.f

If you change this, alter `../../include/R_ext/Lapack.h` accordingly:
it documents those in the first line.

-------------------------------------------------

For 'base' R addition of a new .Call()able Lapack routine,
all these files must be updated {path relative to R's topdir}:

  src/gnuwin32/Rdll.hide
  src/include/R_ext/Lapack.h
  src/include/Rmodules/Rlapack.h
  src/main/basedecl.h
  src/main/lapack.c
  src/main/registration.c
  src/modules/lapack/Lapack.c
  src/modules/lapack/Lapack.h
  src/modules/lapack/cmplx.f or dlapack.f
