Skip to content
Prev 326125 / 398503 Next

How to create a function returning an array ?

@ Duncan, I have already used the syntax that you proposed before asking for help by writing something like
My worry with this syntax is that (i) the program is not very efficient because n and m are very big and these two additional instructions (dim(alpha)<-c(n*m and alpha<-t(alpha) can be skipped just by directly declaring img as an array in fortran instead of a vector and (ii) the syntax will become more complex dealing with a multidimensional array instead of a matrix as in this example.
And this is why I'm looking for the correct instruction to declare img as an array instead of a vector.

Armel

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com] 
Sent: Friday, June 28, 2013 8:16 AM
To: David Winsemius
Cc: Kaptue Tchuente, Armel; r-help at r-project.org
Subject: Re: [R] How to create a function returning an array ?
On 27/06/2013 11:38 PM, David Winsemius wrote:
In fact, out$img has a length of n, same as on input.  .Fortran won't change the length of its arguments.

Duncan Murdoch