NAG Fortran library still has Fortran 77 interfaces

NAG has the most comprehensive numerical library, which I once purchased with personal funds. I wonder why, when NAG has one of the most up-to-date Fortran compilers, that its Fortran library has an old-fashioned Fortran 77 interface. For example, I am implementing ridge regression and wondered if the NAG library had it. It does, with the following interface:

Subroutine g02kaf (n, m, x, ldx, isx, ip, tau, y, h, opt, niter, tol, nep, orig, b, vif, res, rss, df, optloo, perr, ifail)
Integer, Intent (In)	::	n, m, ldx, isx(m), ip, opt, orig, optloo
Integer, Intent (Inout)	::	niter, ifail
Integer, Intent (Out)	::	df
Real (Kind=nag_wp), Intent (In)	::	x(ldx,m), tau, y(n), tol
Real (Kind=nag_wp), Intent (Inout)	::	h
Real (Kind=nag_wp), Intent (Out)	::	nep, b(ip+1), vif(ip), res(n), rss, perr(5)

It should not be necessary for the Fortran programmer to pass array dimensions, and reasonable defaults should be used to minimize the number of required parameter settings for the algorithm.

In R the ridge regression call is just

fit = glmnet(x_var, y_var, alpha = 0, lambda = lambda_seq)
summary(fit)

NAG does a Fortran 90 numerical library, but it has less functionality than the F77 one. The regression and correlation section appears not to include ridge regression.

If NAG were to create modern Fortran wrappers for all of the functionality in its Fortran library, that would make it easier to use.

That is documented in section 12 of the introduction to the F90 library: https://www.nag.com/numeric/fn/manual/pdf/genint/c00s01_essintro_fn04.pdf

This could be a long discussion! You can see that NAG have produced more concise interfaces for python, e.g. naginterfaces.library.correg.ridge_opt — NAG Library for Python 27.1.0.0 documentation

Until fairly recently (in NAG Library terms, Mk1 was released in 1970-71 I think), many compilers were not up to scratch and compiler incompatibilities meant that we had to build the software with the compiler the customer deploys, not the one we develop in-house.

Uptake of the fl90 Library was not stellar, shall we say, and it is no longer a product we sell. With the recent interest in Modern Fortran, and our experience in creating wrappers to the existing Modern Fortran Engine for other languages (see python example above), we may revisit this issue.

2 Likes

That sounds encouraging :slight_smile:

1 Like