[Numpy-discussion] arrays : c aligmen to fortran and back

Thomas Hrabe thrabe at burnham.org
Mon Aug 4 17:21:54 EDT 2008


PS: is there any public C library available which would perform the same operation?

like 
void* swap(int numberDimensions,int sizeDimensions,int dataSize,int conversionType,void* data); 
where conversionType is the flag fortran to c or vice versa.

As it works for numpy, there should be some public C/C++ code available... ???
I would like to have this python call in my C code (without calling an embedded function or so).
xf = np.asfortranarray(x)

Thank you very much,
Thomas

-----Original Message-----
From: numpy-discussion-bounces at scipy.org on behalf of Thomas Hrabe
Sent: Mon 8/4/2008 2:14 PM
To: Discussion of Numerical Python; numpy-discussion-bounces at scipy.org
Subject: RE: [Numpy-discussion] arrays : c aligmen to fortran and back
 
Yeah, this function does the job.
Thank you very much!



-----Original Message-----
From: numpy-discussion-bounces at scipy.org on behalf of Stéfan van der Walt
Sent: Mon 8/4/2008 1:41 AM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] arrays : c aligmen to fortran and back
 
Hi Thomas

2008/8/4 Thomas Hrabe <thrabe at burnham.org>:
> I need to convert a 3d array from c alingment to fortran and was wandering
> for the simplest code available.
> Its all about python and an interfaced C++ program, which, however,
> processes fortran aligned arrays.
>
> Is there a simple code from converting an array
> arr = numpy.array((30,20,10))
>
> to an array arr2 with the same shape
> (arr.shape == arr2.shape)  = true
> where the data is aligned in fortran style.

Does

xf = np.asfortranarray(x)

do what you want?

Stéfan
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3642 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080804/652b3674/attachment.bin>


More information about the NumPy-Discussion mailing list