From bhh at xs4all.nl  Mon Mar  7 18:55:37 2016
From: bhh at xs4all.nl (Berend Hasselman)
Date: Mon, 7 Mar 2016 18:55:37 +0100
Subject: [Rd] ALLOCATE in a FORTRAN subroutine
In-Reply-To: <4dd413361f024d3381b387ea2331a007@NOEINTPEXMU007.NEOPROD.EDF.FR>
References: <6c39c4cbb0fb4e6d80fb36ad28b2b89f@NOEINTPEXMU007.NEOPROD.EDF.FR>
	<VI1PR05MB153679050141DD2F5DE716E2A1BE0@VI1PR05MB1536.eurprd05.prod.outlook.com>
	<4dd413361f024d3381b387ea2331a007@NOEINTPEXMU007.NEOPROD.EDF.FR>
Message-ID: <59C52CB5-61FA-495B-89AB-411A44F959CA@xs4all.nl>


> On 7 Mar 2016, at 16:45, MAURICE Jean - externe <jean-externe.maurice at edf.fr> wrote:
> 
> Hi Martyn,
> 
> Many thanks for your answer. If I make it short : 
> we can, once we know how to do it, 'drive' R from within FORTRAN for example to do a 
>  Myarray = seq(0, mydimension) 
> in R once we have compute mydimension in FORTRAN. Is that correct ?

I too do not understand what you mean by this.

I told you on the R-help mailing list that what you could do is to 

- write a subroutine that calculates the required dimension given your parameters; you can do this within R code.
- allocate in R (or C) a matrix/vector/.. with the required dimension.
- call your Fortran subroutine(s) with the allocated matrix/vector

There are several packages, as I replied before on the R help list,  that do this (from within an R function or a C function).


Berend

> If yes : it's too 'complicated' for the time I am hired (I mean I have been hired to do FORTRAN code not to learn R !).
> 
> Second question : for what I have understood in r_exts, it's more 'efficient' to translate R routines in C rather than in FORTRAN (speed must be the 'same', but there are a lot more possibilities in C for the programmer) : right ? I do not know why my customer (client ?) wanted to translate some R routines in FORTRAN. May be it's by accident (in my humble opinion they even don't know about C). If you confirm this fact, I'll speak about C with my customer because we are at the very beginning of great works (great amounts of work ?) and I don't matter, I am also a skilled C programmer !!
> 
> I hope you understand what I want to say, english is not my natural language !
> 
> Thanks again and best regards.
> Jean
> 
> 
> 
> Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.
> 
> Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message.
> 
> Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus.
> ____________________________________________________
> 
> This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.
> 
> If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.
> 
> E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] ALLOCATE in a FORTRAN subroutine
Berend Hasselman