Dear Forum:

I would like to use Fortran programs and I tried the some examples in
http://www.stat.umn.edu/~charlie/rc/.
This page describes how to call C or Fortran from R.

As for J user if the similar home page exists, it would be very fine.

      subroutine bar(n, x)

      integer n
      double precision x(n)
      integer i

      do 100 i = 1, n
          x(i) = x(i) ** 2
  100 continue

      end

For the above case I have not yet succeeded in calling from J.
I am user of Mac OS X 10.4.9 (intel mac).

R CMD SHLIB bar.f
'/Users/kamakura/work/corf/bar.so bar + n *i *d'& cd (<,10),(<0+>:i.10)

|domain error: cd
| '/Users/kamakura/work/corf/bar.so bar + n *i *d'&cd(<,10),(<0 +>:i.10)
   cder ''
2 0

Of course, R can do that.
> dyn.load("/Users/kamakura/work/corf/bar.so")
> .Fortran("bar",as.integer(10),as.double(1:10))
[[1]]
[1] 10

[[2]]
[1]   1   4   9  16  25  36  49  64  81 100

Best regards.

Toshinari Kamakura

+++++++++++++++++++++++++++++
    Toshinari Kamakura

    Chuo University
    1-13-27 Kasuga
    Bunkyo-ku
    Tokyo 112-8551, Japan
++++++++++++++++++++++++++++++



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to