[PYTHON MATRIX-SIG] fft's
Konrad HINSEN
hinsenk@ere.umontreal.ca
Wed, 28 Feb 1996 17:02:55 -0500
> n1 and n2 are defined as follows:
>
> N1 - INTEGER.
> On entry, N1 specifies the number of elements in the
> first dimension of the sequence.
> Unchanged on exit.
> N2 - INTEGER.
> On entry, N2 specifies the number of elements in the
> second dimension of the sequence.
> Unchanged on exit.
So these describe the number of data points...
> and LDA is defined as:
>
> LDA - INTEGER.
> On entry, LDA specifies the first dimension of the
> array SEQUENCE as declared in the calling (sub)program.
> LDA must be at least max( 1, 2*((N1+2)/2) ).
> Unchanged on exit.
and this the physical size of the grid. The reason for having both
is that you might want to dimension some arrays larger than necessary
to avoid recompilation for every different value of N1/N2. Remember,
we are talking about a library designed for a language without
dynamic allocation! In the case of Python, you would most certainly
allocate an array of the correct size and LDA would be equal
to N1. You will find these "LDA" parameters everywhere in Fortran
libraries.
> I realize that fortran and C/Python index into arrays differently (row
> vs. column first). What is a good way of dealing with this?
Your interface should make sense to Python users. They won't
see the Fortran source code anyway and probably don't even care
whether it's Fortran.
> really rank 1, 2, or 3 but designed for antiquated languages. Should I
> do the conversion to the appropriate rank (e.g. the assignment of shape)
> in a .py wrapper, so that the library module itself is as compatible w/
> the fortran and C interfaces, or should I make the library
> python-friendly, and have it return appropriately sized arrays?
It matters only that the function that end users call uses correctly
shaped arrays. Personally, I'd use the correct shape also for the
low-level interface, because there is no possible use for 1d access.
But if you prefer otherwise, I don't care.
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal | Fax: +1-514-343-7586
C.P. 6128, succ. Centre-Ville | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7 | Francais (phase experimentale)
-------------------------------------------------------------------------------
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================