[Numpy-discussion] NumPy C-API - copying from Fortran to C order

Nichols A. Romero naromero at gmail.com
Wed Aug 12 12:48:56 EDT 2009


Hi,

I am working on a *very* simple Python interface to ScaLAPACK using the
NumPy C-API. I am not
using f2py at all.

Simple question:
How can I copy a C-order NumPy array into a Fortran-order NumPy array within
the C-API?
(This is trivial in Python, it is simply A = A.copy("Fortran"))

I would like to do this with the minimal amount of memory use. The matrices
are 2-d and rectangular,
but not square.

It looks like I  use PyArray_CopyInto or PyArray_MoveInto, but I would need
to create another array using PyArray_EMPTY(2, dims, NPY_DOUBLE,
NPY_F_CONTIGUOUS)

Thanks in advance for your assistance.

-- 
Nichols A. Romero, Ph.D.
Argonne Leadership Computing Facility
Argonne, IL 60490
(630) 252-3441 (O)
(630) 470-0462 (C)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090812/7de5244e/attachment.html>


More information about the NumPy-Discussion mailing list