Skip to content

Calling a LAPACK subroutine from R

1 message · Göran Broström

#
Hi guys,

interestingly, my problem seems to be solved by writing a FORTRAN 
wrapper for the Fortran code! (As long as the check doesn't get 
smarter...). This is the relevant part of my Fortran code:
-----------------------------------------------------------
       subroutine gmlfun(what,
      &     totevent, totrs, ns,
      &     antrs, antevents, size,
      &     totsize, eventset, riskset,
      &     nn, antcov, covar, offset,
      &     beta, gamma,
      &     loglik, h1, h2, h11, h21, h22,
      &     score)

......
       call gmlfun1(what,
      &     totevent, totrs, ns,
      &     antrs, antevents, size,
      &     totsize, eventset, riskset,
      &     nn, antcov, covar, offset,
      &     beta, gamma,
      &     loglik, h1, h2, h11, h21, h22,
      &     score)

	return
         end

C ***
C
       subroutine gmlfun1(what,
      &     totevent, totrs, ns,
      &     antrs, antevents, size,
      &     totsize, eventset, riskset,
      &     nn, antcov, covar, offset,
      &     beta, gamma,
      &     loglik, h1, h2, h11, h21, h22,
      &     score)
.....

C
       call dcopy(nn, offset, ione, score, ione)
       call dgemv(trans, nn, antcov, one, covar, nn, beta, ione, one,
      &     score, ione)
  .....
	return
	end
-----------------------------------------------------------------
gmlfun is called directly by .Fortran, and in my original code gmlfun 
was gmlfun1. Now gmlfun is just a wrapper that calls gmlfun1, which 
calls dgemv, and no complaints!

This is apparently what Berend (and now myself) gets away with: Quite 
bizarre in my mind.

Or: Is this an R-blessed solution?

Thanks, G?ran
On 2019-09-12 11:25, Tomas Kalibera wrote: