s-news
[Top] [All Lists]

Re: [S] problems on calling Fortran

To: chuck@statsci.com
Subject: Re: [S] problems on calling Fortran
From: "Chunlei KE" <ke97@hotmail.com>
Date: Fri, 22 Oct 1999 10:24:44 PDT
Cc: S-news@wubios.wustl.edu
Sender: owner-s-news@wubios.wustl.edu

Dear Chuck,

I am sorry for my confusing Q_1, Q_2 , but I used q1, q2 instead of Q_1, Q_2 in my program.

Yesterday, I also tried to avoid the array argument by writing another fortran program, which takes q1, q2 as argument directly. The weired thing is that it gives correct results in Fortran, but wrong answers when calling in Splus. I am pretty sure that the input arguments are the same completely. It seems to me that something strange happens when the results are transported into Splus from Fortran.

Thank you very much!

Regards,
Chunlei Ke

From: Chuck Taylor <chuck@statsci.com>
To: Chunlei KE <ke97@hotmail.com>
Subject: Re: [S] problems on calling Fortran
Date: Fri, 22 Oct 1999 07:52:02 -0700 (PDT)

The underscore character ("_") in S-PLUS is an alternate form of the
assignment operator ("<-"), which means you cannot use it as part of a
variable name. Your expression

 >array(c(Q_1, Q_2), dim=c(n, n, 2))

is the same in S-PLUS as

 >array(c(Q<-1, Q<-2), dim=c(n, n, 2))

A better choice is to name your variables "Q1" and Q2" or "Q.1" and "Q.2".

|-----------------------------------------------------------------------|
| Chuck Taylor                       Senior Quality Assurance Engineer  |
| MathSoft Seattle, WA, USA          chuck@statsci.com                  |
|                                                                       |
| "All statements in this message represent the opinions of the author  |
| and do not necessarily reflect official MathSoft policy or position." |
|-----------------------------------------------------------------------|


On Thu, 21 Oct 1999, Chunlei KE wrote:

>
> Dear S+ users,
>
> I am trying to call a Rational Fortran subroutine "dmudr" written for
> smoothing spline with "dyn.load" and ".Fortran" in S+. The input for "dmudr" > includes: a vector, a matrix (n*m) and an array (n*n*2). There is no problem > with loading of "dmudr". But when running it, I couldn't get the correct
> results though "dmudr" runs well in Fortan.
>
> I constructed the array in S+ as:
>
> >array(c(Q_1, Q_2), dim=c(n, n, 2))
>
> where Q_1, Q_2 are both n*n matrices, and then passed to "dmudr". I checked > the matrices and vector and the programs many times and couldn't figure out
> what's going on.
>
> Can someone please tell me wether I made the array correctly, and what may
> cause the problems? Thank you very much!
>
> I am using Splus 3.4 on Unix
>
> Regards,
> Chunlei Ke


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>