Paul F. Dubois | 1 Aug 01:36 2001

Help: need info on Fortran/C mixing on Windows

Any fellow nummies and Pythonistas out there with experience using Digital
Fortran on Windows?

I'm trying to get Pyfort to work with Visual Fortran / Visual C++ on
Windows. I am not usually a Windows developer so I do not know how to do
things like look at an object file to see what names are in it (as I could
do with nm on Unix). I have discovered that by including
c$DEC ATTRIBUTES C:: foo
in my Fortran, where foo is the name of my Fortran function, that my missing
external for foo disappears. This is not really ok as I want to be able to
link to unmodified Fortran files that have simply been compiled into a
foostuff.lib file.

I need information such as:

How to get the names to match up, or what name to generate in my C to
correspond to the Fortran;

Which library to load with: I've tried dfor.lib and dformd.lib, in the
context of running a python extension link through distutils, and both
complain vociferously about library conflicts.

If this was my working life I could afford to put in the time to figure all
this out, but this is pro bono publico and I would appreciate your tolerance
of my asking for help.

Even just your Makefile or setup.py from a successful project of this type
would be a big help.

Thanks,
(Continue reading)

Nathaniel Gray | 3 Aug 02:18 2001
Picon

A savespace bug, perhaps?

Hi everybody,

I'm using Python 2.1.1 and Numpy 20.1.0  This seems to be a problem:

Python 2.1.1 (#2, Jul 31 2001, 14:10:42)                                     
[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> from Numeric import *
>>> from MLab import zeros
>>> joe = zeros(3,'l',1)
>>> fred = array([1,2,3],'l')
>>> joe += fred
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: return array has incorrect type

This fails whether or not fred has the spacesaver flag set.

This, however, works fine:
>>> joe = zeros(3, 'l')
>>> fred = array([1,2,3], 'l')
>>> joe += fred
>>> joe
array([1, 2, 3])

Am I doing something wrong or is this a bug?

Please CC to me since I'm not subscribed to the list.
Thanks a lot!
-Nathan
(Continue reading)

Travis Oliphant | 2 Aug 21:13 2001
Picon

Re: A savespace bug, perhaps?

On Fri, 03 Aug 2001, Nathaniel Gray wrote:
> Hi everybody,
>
> I'm using Python 2.1.1 and Numpy 20.1.0  This seems to be a problem:
>
> Python 2.1.1 (#2, Jul 31 2001, 14:10:42)
> [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
> Type "copyright", "credits" or "license" for more information.
>
> >>> from Numeric import *
> >>> from MLab import zeros
> >>> joe = zeros(3,'l',1)
> >>> fred = array([1,2,3],'l')
> >>> joe += fred
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: return array has incorrect type
>
> This fails whether or not fred has the spacesaver flag set.
>
> This, however, works fine:
> >>> joe = zeros(3, 'l')
> >>> fred = array([1,2,3], 'l')
> >>> joe += fred
> >>> joe
>
> array([1, 2, 3])
>
> Am I doing something wrong or is this a bug?
(Continue reading)

Rob | 4 Aug 00:11 2001
Picon

new to list

Hello,

I'm new to the list so I thought I'd introduce myself.  I use Numpy at
work for some Python programs that interface with Agilent and/or Anritsu
microwave equipment, using the GPIB bus.

However, my main interest lately is porting some EM codes into Numeric
Python.  I've had varied success.  See my web site
www.members.home.net/europax.  Right now I'm trying to Numpy-ize this
FEM-MOM code.  I've profiled it using the Python profile class.  Using
MOM for a dipole takes 5 minutes of cpu :) :)  Interestingly, some of
the worst routines are simple ones that really have little to do with
matrix math.
Anyway, I'm having fun.  Its wonderful to be able to focus on algorithms
rather than wading through arcane programming syntax !!

Rob.

이규봉 | 7 Aug 04:45 2001
Picon

NumTut

Dear who may be concerned,
 
I want to install the package NumTut. But I can't find the directory of source distribution. Please let me know how to get the directory odf souce distribution and the subdirectory Demo.
 
Thanks
 
Gyoy-Bong Lee from Korea
Paul F. Dubois | 7 Aug 19:20 2001

swig and Numeric

Does someone have an example of using SWIG to connect Numeric arrays to C code
that expects double* arguments?

Hung Jung Lu | 7 Aug 21:50 2001
Picon

fast constructor for arrays from byte data (unpickling?)

Hi,

Arrays have a method called tostring() which generates
the binary data. Is there an inverse function to that?
That is, generating an array from the binary data
string?

For large matrices, pickling/unpickling is a bit too
much overhead (data stored as ASCII character strings
instead of binary data strings.) I know, I am talking
about a factor 4 here. But there is a big difference
between 1 minute loading time and 4 minute loading
time.

I would imagine this is a very common problem/request
for people working with large matrices. And I am sure
hacking the C code to provide another fast constructor
for arrays from binary strings won't be too hard. The
questions is: has anyone already tried it? Is it
already there?

(For the kludge masters: one kludge is of course to
store the binary data on disk, then use cStringIO to
build the pickled file and then unpickle from the
cStringIO. Speed is probably OK since the pickled file
lives on RAM. But that's a kludge. :) )

regards,

Hung Jung

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Robert Kern | 7 Aug 21:59 2001
Picon

Re: fast constructor for arrays from byte data (unpickling?)

On Tue, Aug 07, 2001 at 12:50:04PM -0700, Hung Jung Lu wrote:
> Hi,
> 
> Arrays have a method called tostring() which generates
> the binary data. Is there an inverse function to that?
> That is, generating an array from the binary data
> string?

Numeric.fromstring

HTH.

--

-- 
Robert Kern
kern <at> caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

Chris Barker | 7 Aug 22:26 2001
Picon

Re: fast constructor for arrays from byte data (unpickling?)

Hung Jung Lu wrote:
> Arrays have a method called tostring() which generates
> the binary data. Is there an inverse function to that?
> That is, generating an array from the binary data
> string?

As you suspected, there is such a thing, and it is called (surprise):
fromstring(). It is a function, rather than a method, as it is a
constructor for an array. To get data from a file, you have to get it
into a string first, so I use:

M = fromstring(file.read(),Float)

This makes a rank -1 array. You might have to reshape it.

Note that you end up creating a Python string of the data first, and
then a NumPy array from that. This doesn't really cost that much, but it
can be an issue with huge data sets. I wish there was a fromfile()
function. I may get around to writing it one day.

-Chris

--

-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker <at> home.net                 ---           ---           ---
http://members.home.net/barkerlohmann --- <at>  <at>        ----- <at>  <at>        ----- <at>  <at> 
                                   ------ <at>  <at>  <at>      ------ <at>  <at>  <at>      ------ <at>  <at>  <at> 
Oil Spill Modeling                ------    <at>     ------    <at>    ------    <at> 
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------

Hung Jung Lu | 7 Aug 22:08 2001
Picon

Re: fast constructor for arrays from byte data (unpickling?)

> > That is, generating an array from the binary data
> > string?
> 
> Numeric.fromstring

Ahhh! Now that seems so obvious. :) (Banging my head.)

thanks!

Hung Jung

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


Gmane