@@ -6390,7 +6390,7 @@ warning: argument 1 value '18446744073709551615' exceeds maximum object
63906390@item
63916391Some authors feel the need to print (using @code{Rprintf} or
63926392similar) vector lengths or indices which are of type @code{R_xlen_t}.
6393- That may be a 32-bit or (most commonly) 64-bit type but which integer
6393+ That is (almost always) a 64-bit type but which integer
63946394type it is mapped to is platform-specific. The safest way is to cast
63956395the length to double and use a double format. So one could use
63966396something like
@@ -6419,7 +6419,7 @@ So the values will need to be cast to the type assumed by the format
64196419@I{Variadic} macros in C or C++ only portably allow a non-zero number of
64206420arguments, although some compilers have allowed zero, often with a
64216421warning. The latter was standardized in C++20 using the @code{__VA_OPT__}
6422- macro. C23 also allows zero arguments in a similar way.
6422+ macro. C23 allows zero arguments in a similar way.
64236423
64246424@end itemize
64256425
@@ -6430,10 +6430,10 @@ by @I{Martyn Plummer}.
64306430Several OSes have or currently do provide multiple C++ runtimes ---
64316431Solaris did and the @I{LLVM} @command{clang} compiler has a native C++
64326432runtime library @code{libc++} but is also used with GCC's
6433- @code{libstdc++} (by default on Debian/Ubuntu). This makes it unsafe to
6434- assume that OS libraries with a C++ interface are compatible with the
6435- C++ compiler specified by @R{}. Many of these system libraries also
6436- have C interfaces which should be used in preference to their C++
6433+ @code{libstdc++} (by default on Debian/Ubuntu/Fedora ). This makes it
6434+ unsafe to assume that OS libraries with a C++ interface are compatible
6435+ with the C++ compiler specified by @R{}. Many of these system libraries
6436+ also have C interfaces which should be used in preference to their C++
64376437interface. Otherwise it is essential that a package checks
64386438compatibility in its @command{configure} script, including that C++ code
64396439using the library can both be linked @emph{and loaded}.
@@ -15737,8 +15737,8 @@ Cdgemm(const char *transa, const char *transb, const int *m,
1573715737@end example
1573815738
1573915739@noindent
15740- Alternatively, do as @R{} does as from version 3.6.2 and pass
15741- the character length(s) from C to Fortran. A portable way to do this is
15740+ Alternatively, do as @R{} does and pass the character length(s) from C
15741+ to Fortran. A portable way to do this is
1574215742@example
1574315743// before any R headers, or define in PKG_CPPFLAGS
1574415744#ifndef USE_FC_LEN_T
@@ -15755,9 +15755,9 @@ the character length(s) from C to Fortran. A portable way to do this is
1575515755@end example
1575615756@noindent
1575715757(Note there is no comma before or between the @code{FCONE} invocations.)
15758- It is strongly recommended that packages which call from C/C++
15759- BLAS/LAPACK routines with character arguments adopt this approach:
15760- packages not using it will fail to install as from @R{} 4.3.0 .
15758+ Packages which call from C/C++ BLAS/LAPACK routines with character
15759+ arguments must adopt this approach: packages not using it will now fail
15760+ to install.
1576115761
1576215762@node Fortran LOGICAL
1576315763@subsection Fortran LOGICAL
@@ -16696,6 +16696,59 @@ the original functions by Fox, Hall and @I{Schryer} on @I{Netlib} at
1669616696@apifun d1mach
1669716697@apifun i1mach
1669816698
16699+ @node Linear algebra
16700+ @section Linear algebra
16701+
16702+ The preferred way to do numerical linear algebra from C/Fortran code is
16703+ to use BLAS/LAPACK@footnote{The distinction is increasing blurred, with
16704+ the reference BLAS being distributed as part of the LAPACK sources.}
16705+ Declarations callable from C/C++ are provided in headers
16706+ @file{R_ext/BLAS.h} and @file{R_ext/LAPACK.h}.
16707+
16708+ However, a number of Fortran routines are included in @R{} and underlie
16709+ @code{lm.fit()}, @code{lm.wfit()} and @code{qr(LAPACK = FALSE)} and its
16710+ helper functions. These remain available to packages which wish to
16711+ emulate what @R{} does, and are declared as a C/C++ interface in header
16712+ @file{R_ext/Applic.h}. But they are also often called @emph{via}
16713+ @code{.Fortran()} and from Fortran code.
16714+
16715+ @apifun dqrqty
16716+ @apifun dqrqy
16717+ @apifun dqrcf
16718+ @apifun dqrrsd
16719+ @apifun dqrxb
16720+ @apifun dqrls
16721+ @apifun dqrdc2
16722+ @example
16723+ void F77_NAME(dqrqty)(double *x, int *n, int *k, double *qraux,
16724+ double *y, int *ny, double *qty);
16725+ void F77_NAME(dqrqy)(double *x, int *n, int *k, double *qraux,
16726+ double *y, int *ny, double *qy);
16727+ void F77_NAME(dqrcf)(double *x, int *n, int *k, double *qraux,
16728+ double *y, int *ny, double *b, int *info);
16729+ void F77_NAME(dqrrsd)(double *x, int *n, int *k, double *qraux,
16730+ double *y, int *ny, double *rsd);
16731+ void F77_NAME(dqrxb)(double *x, int *n, int *k, double *qraux,
16732+ double *y, int *ny, double *xb);
16733+ void F77_NAME(dqrls)(double *x, int *n, int *p, double *y, int *ny,
16734+ double *tol, double *b, double *rsd,
16735+ double *qty, int *k,
16736+ int *jpvt, double *qraux, double *work);
16737+ void F77_NAME(dqrdc2)(double *x, int *ldx, int *n, int *p,
16738+ double *tol, int *rank,
16739+ double *qraux, int *pivot, double *work);
16740+ @end example
16741+ @noindent
16742+ For further datails see their source files in directory @file{src/Appl}
16743+ in the @R{} sources or @uref{https://netlib.org/linpack/}.
16744+ @code{dqrdc2} is an extensive @R{} modification to LINPACK's
16745+ @code{dqrdc} which uses column pivoting and computes the (numerical)
16746+ rank.
16747+
16748+ These are for the time being regarded as part of the API but may in
16749+ future be supplemented or replaced by interfaces using Fortran 2003's
16750+ @code{bind(C)}.
16751+
1669916752
1670016753@node Re-encoding
1670116754@section Re-encoding
0 commit comments