From r.hooft@euromail.net  Thu Apr  1 07:20:34 1999
From: r.hooft@euromail.net (Rob Hooft)
Date: Thu, 1 Apr 1999 09:20:34 +0200 (MZT)
Subject: [Matrix-SIG] We should rename convolve in multiarraymodule
In-Reply-To: <14082.19796.617146.777055@gargle.gargle.HOWL>
References: <Pine.LNX.4.04.9903302149410.22213-100000@us2.mayo.edu>
 <14082.12420.791560.287953@gargle.gargle.HOWL>
 <37023835.D98FC3B@cfa.harvard.edu>
 <14082.19796.617146.777055@gargle.gargle.HOWL>
Message-ID: <14083.7746.111544.838766@octopus.chem.uu.nl>

>>>>> "LS" == Les Schaffer <godzilla@netmeg.net> writes:

 LS> subst convolve correlate `find . -name "*.py"`

There is a few things wrong here:

 1) we're discussing perl instead of python now

 2) I agree 100% that this BUG should be fixed, and that bug compatibility
    is a silly thing. My original message was there because I think "normal"
    backward compatibility is very important, even in python.

 3) Replacing "convolve" by "correlate" doesn't solve the problem: if I'm
    professionally writing a python program I need to make sure that
    it will run at every customer site. I.e. I need to code it  like:

       if this_site_is_running_a_corrected_version:
          correlate(xxx)
       else:
          convolve(xxx)

    Requiring all customers to upgrade when something like this changes
    is not always an option.

Regards,

-- 
=====   R.Hooft@EuroMail.net   http://www.xs4all.nl/~hooft/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========



From gathmann@scar.utoronto.ca  Thu Apr  1 14:43:56 1999
From: gathmann@scar.utoronto.ca (Oliver Gathmann)
Date: Thu, 1 Apr 1999 09:43:56 -0500 (EST)
Subject: [Matrix-SIG] RE: ANN: PyDAS
Message-ID: <Pine.GSO.4.05.9904010935230.19713-100000@banks.scar>

I only this morning discovered that the new blt version (blt2.4h) produces
strange core dumps under Linux/glibc2.0.6 
(the gdb message is "Program terminated with signal 11,
Segmentation fault. find_solib: Can't read pathname for load map").

This did not happen with blt2.4g; if you are experiencing the same
problems, you can get the old blt2.4g sources at
	http://www.scar.utoronto.ca/~gathmann/PyDAS/support

Sorry for the inconvenience!

Oliver

F. Oliver Gathmann (gathmann@scar.utoronto.ca)
Surface and Groundwater Ecology Research Group      
University of Toronto
phone: (416) - 287 7420 ; fax: (416) - 287 7423     
web: http://www.scar.utoronto.ca/~gathmann



From dubois1@llnl.gov  Fri Apr  2 01:02:29 1999
From: dubois1@llnl.gov (Paul F. Dubois)
Date: Thu, 1 Apr 1999 17:02:29 -0800
Subject: [Matrix-SIG] LLNL Distribution 11 (gamma) available
Message-ID: <000801be7ca4$7bbfca00$f4160218@c1004579-c.plstn1.sfba.home.com>

LLNL Distribution 11 is available as a gamma. This means, it is available
and I think it works but the number of beta testers was not large enough and
so I don't want to make it "the" release yet. Linux, Solaris, and Win 98
with VC++ 6.0 have worked for me and others.

You can get the files as:

ftp://ftp-icf.llnl.gov/pub/python/LLNLDistribution11.tgz (for Unix)

ftp://ftp-icf.llnl.gov/pub/python/LLNLDistribution11.zip (for Windows)

Please read the rest of this message before using.

Unpack the distribution and read the Release_Notes and INSTALL files in the
top level directory for the low-down on the new installation procedure. In
particular, there is no more Windows "installer". (Yeah!) You just cd to
Numerical and double-click on windows_install.bat.

The Windows file contains the prebuilt libraries. Unix users will need to
run
python makethis.py
python installthis.py
in each package you want to make, as instructed.

If you were a Windowser who had trouble with the Version 10 installer this
ought to do the trick. I am rushing this out to solve that problem. Some
previous posters on comp.lang.python have said how to edit the registry to
get it to work with pre-1.5.2 Pythons if you don't like the uncertain tone
of this announcement.

If you don't have Python 1.5 then post-install you should fix your
PYTHONPATH environment variable to include the directory where numeric is
installed.

The one feature I am seriously worried about is described in the release
notes and instructions are given for how to compile it out in case I blew
it.

Please note that convolve has been renamed to cross_correlate and a proper
convolve added. This incompatible change is regretted but necessary. As a
matter of philosophy I prefer not to add attempts to detect versions and
change behaviors. See the subject "Windows installer" for the source of this
antisocial view. My feeling is that few people were using this function but
if you are one of them you will break your code if you install this version
without corrective action.







From wilsona@earthlink.net  Fri Apr  2 20:47:14 1999
From: wilsona@earthlink.net (Anthony L. Wilson)
Date: Fri, 02 Apr 1999 15:47:14 -0500
Subject: [Matrix-SIG] Using Python or Java for data analysis(no flame wars please)
Message-ID: <37052CD1.C31620EA@thinkapple.com>

Hello,
At this time I am posing a question to the readers/users/developers on
these various newsgroups and mailing lists.

At the moment I am contemplating development of a small - medium size
application.  I am contemplating using either Python or Java.  I do not
wish this to be flame war on which is a better language, but I would
like some serious comments on aspects of each language as it applies to
the application that I am trying to develop.

My background consists of Fortran and C programming with some Python and
Java.  Why use Python or Java?  Because I would to have the gui part and
the platform portability given by the two(more on this later) along with
learning a new language.  i have used Python more so then Java.  This
has been on my Macintosh and Linux machine.

Why Python?
In using Python, I have found it to be simple to use and understand, yet
powerful.  With NumPy, for numerical extensions, and access to plotting
libs like DISLIN, PLplot, PGplot, GNU plotutils, BLT, Gist, and Gnuplot
OpenGL(based on website) Python presents several features that I would
like to utilize. Along with the GUI frameworks that Python uses:
Tkinter, wxPython, and PyGtk.The problem here is speed and cross
platform( limitied plotting and GUI libs for Macintosh port of Python)

Why Java?
Java presents several areas that my be utilized with the main one being
the new 2D API.  It also has a standard built in GUI system.  There are
numerical facilities that will be useful.  Plotting may be a problem,
but once its implemented, it should run on any Java VM(right??).
Why not do a mix? Use JPython.  This is a thought that I am
considering.  Please give pros and cons based on criteria/feature list
below.

First, I will give a general overview of what I am thinking about.
Anyone with pointers on something similar please let me know.  I would
hate to re-invent the wheel, unless I had to.

Application Overview:  I would like to develop a data analysis tool for
viewing/manipulating circuit simulation data, i.e. a post processor.
Basically, I need to be able to read-in/parse the data ( all 2-d data)
which is in a general form produced by a simulation run( there is a
common format for all SPICE simulators).  The numbers will mostly be of
type float, but may also be in engineering notation.  I need to be able
to plot the data( 2-d, lin-lin, log-lin, lin-log, log-log, and smith
charts).  I would also need to be able access the data for interactive
analysis( fft, curve fitting, time series analysis, etc).  I would also
need access to the basic math and trig functions(  +, -, *, / , ^, sin,
cos, tan, asin, acos, atan, etc).  This should all be implemented via a
GUI front-end.  If you are familiar with HSPICE(tm) or CADENCE Design
Tools(tm), then this would be similar to their calculator tools.
Basically I am looking at a graphing calculator with data analysis
aspects with a GUI front-end.

General Needs:
-------------
GUI Support
Numerial Support with analysis routines
File I/O Support
2-D plotting support

Targeted Platforms:  Macintosh(PowerPC only) and Linux

Current Machine Configurations:
------------------------
Mac OS 8.5
MRJ 2.1.1 and Metrowerks Codewarrior Pro 4
MacPython 1.5.1 w/ NumPy

RedHat Linux 5.2
Linux Java SDK 1.1.7 from Blackdown.Org
Python 1.5.1 w/ NumPy


Feature List
----------
Things that I would appreciate some comments about in respect to Python
and/or Java implementation.  These are in order of importance.  Please
indicate which platform(Macintosh or Linux), if feature can only be
implemented on that platform, and language implementation.
1).  File Input parsing into some usable form
2).  2 -D plotting.  This would also include interactive labeling and
such.
3).  X-Y labeling
4).  GUI for the calculator front end
5).  Numerical Analysis Support.  for data processing
6). speed
7). Application delivery.  Final product as an application for others to
use.

I know this is a bit much for a single person development, but I would
like to take a shot at developing it using a language that can handle
the task.  I would definitely prefer not to have to start over in a new
language half way through.

At the moment, I am leaning towards using Java because of the cross
platform and new 2D API support.  But Python, I really like and its
easier to program using Python.

I would appreciate any comments on any aspect of this development.
Please only serious commentary.  I would like to use the best language
for the job.

Thanks very much.

-anthony wilson
http://home.earthlink.net/`wilsona
mailto:wilsona@earthlink.net
mailto:alwkappa@ThinkApple.com



From Oliphant.Travis@mayo.edu  Fri Apr  2 23:45:08 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Fri, 2 Apr 1999 17:45:08 -0600 (EST)
Subject: [Matrix-SIG] Source and Binary RPMS for Release 11
Message-ID: <Pine.LNX.4.04.9904021726440.3634-100000@us2.mayo.edu>

I've just put up source RPMS and i386-Linux binary RPMS for Release 11 of
Numerical Python at.
http://oliphant.netpedia.net

The RPMS include all of the documentation for gist and NumPy that I could
find in *.ps and *.pdf format.

-- Travis

P.S.

Thanks for incorporating the convolve change, Paul.  It's probably a
personality flaw but I can't tell you how tickled I was to see this
output from NumPy:

>>> convolve([2,3,5],[1,2,5],2)
array([ 2,  7, 21, 25, 25])

and compare it with MATLAB's

>> conv([2,3,5],[1,2,5])       

ans =

     2     7    21    25    25


Sweet...




From dubois1@llnl.gov  Sat Apr  3 01:08:09 1999
From: dubois1@llnl.gov (Paul F. Dubois)
Date: Fri, 2 Apr 1999 17:08:09 -0800
Subject: [Matrix-SIG] Numerical Python download site temporarily changed
Message-ID: <000701be7d6e$70ae53a0$f4160218@c1004579-c.plstn1.sfba.home.com>

The normal site LLNL site for Numerical Python downloads, xfiles.llnl.gov,
is and will be unavailable for some days.

Lacking sufficient notice to do anything better, I have copied the last two
releases and the Numerical Python documentation to my own personal web site.
The URL is:

http://dubois.simplenet.com/python

I will post to this group when xfiles is again available.

We regret any inconvenience to the public.

Paul F. Dubois
Lawrence Livermore National Lab






From michaelb@gold.net.au  Mon Apr  5 08:28:12 1999
From: michaelb@gold.net.au (Michael Bell)
Date: Mon, 5 Apr 1999 15:28:12 +0800 (WST)
Subject: [Matrix-SIG] Rose plotting widjet?
Message-ID: <m10U3no-00000FC@belfry.gold.net.au>

I need to plot some wind-roses.  Has anyone developed one themselves,
or know of where one may be found?

[A wind-rose is a plot of wind speed distribution versus direction. It
looks vaguely flower-like, where each petal in some fashion presents
the distribution of some quantity, usually speed, in that direction.]

My Tkinter code is very ugly, and I'd rather use someone else's if it
already exists.

Thanks,
-- 
Michael Bell
Kalgoorlie, Western Australia.


From wilsona@earthlink.net  Fri Apr  2 20:47:14 1999
From: wilsona@earthlink.net (Anthony L. Wilson)
Date: Fri, 02 Apr 1999 15:47:14 -0500
Subject: [Matrix-SIG] Using Python or Java for data analysis(no flame wars please)
Message-ID: <37052CD1.C31620EA@thinkapple.com>

Hello,
At this time I am posing a question to the readers/users/developers on
these various newsgroups and mailing lists.

At the moment I am contemplating development of a small - medium size
application.  I am contemplating using either Python or Java.  I do not
wish this to be flame war on which is a better language, but I would
like some serious comments on aspects of each language as it applies to
the application that I am trying to develop.

My background consists of Fortran and C programming with some Python and
Java.  Why use Python or Java?  Because I would to have the gui part and
the platform portability given by the two(more on this later) along with
learning a new language.  i have used Python more so then Java.  This
has been on my Macintosh and Linux machine.

Why Python?
In using Python, I have found it to be simple to use and understand, yet
powerful.  With NumPy, for numerical extensions, and access to plotting
libs like DISLIN, PLplot, PGplot, GNU plotutils, BLT, Gist, and Gnuplot
OpenGL(based on website) Python presents several features that I would
like to utilize. Along with the GUI frameworks that Python uses:
Tkinter, wxPython, and PyGtk.The problem here is speed and cross
platform( limitied plotting and GUI libs for Macintosh port of Python)

Why Java?
Java presents several areas that my be utilized with the main one being
the new 2D API.  It also has a standard built in GUI system.  There are
numerical facilities that will be useful.  Plotting may be a problem,
but once its implemented, it should run on any Java VM(right??).
Why not do a mix? Use JPython.  This is a thought that I am
considering.  Please give pros and cons based on criteria/feature list
below.

First, I will give a general overview of what I am thinking about.
Anyone with pointers on something similar please let me know.  I would
hate to re-invent the wheel, unless I had to.

Application Overview:  I would like to develop a data analysis tool for
viewing/manipulating circuit simulation data, i.e. a post processor.
Basically, I need to be able to read-in/parse the data ( all 2-d data)
which is in a general form produced by a simulation run( there is a
common format for all SPICE simulators).  The numbers will mostly be of
type float, but may also be in engineering notation.  I need to be able
to plot the data( 2-d, lin-lin, log-lin, lin-log, log-log, and smith
charts).  I would also need to be able access the data for interactive
analysis( fft, curve fitting, time series analysis, etc).  I would also
need access to the basic math and trig functions(  +, -, *, / , ^, sin,
cos, tan, asin, acos, atan, etc).  This should all be implemented via a
GUI front-end.  If you are familiar with HSPICE(tm) or CADENCE Design
Tools(tm), then this would be similar to their calculator tools.
Basically I am looking at a graphing calculator with data analysis
aspects with a GUI front-end.

General Needs:
-------------
GUI Support
Numerial Support with analysis routines
File I/O Support
2-D plotting support

Targeted Platforms:  Macintosh(PowerPC only) and Linux

Current Machine Configurations:
------------------------
Mac OS 8.5
MRJ 2.1.1 and Metrowerks Codewarrior Pro 4
MacPython 1.5.1 w/ NumPy

RedHat Linux 5.2
Linux Java SDK 1.1.7 from Blackdown.Org
Python 1.5.1 w/ NumPy


Feature List
----------
Things that I would appreciate some comments about in respect to Python
and/or Java implementation.  These are in order of importance.  Please
indicate which platform(Macintosh or Linux), if feature can only be
implemented on that platform, and language implementation.
1).  File Input parsing into some usable form
2).  2 -D plotting.  This would also include interactive labeling and
such.
3).  X-Y labeling
4).  GUI for the calculator front end
5).  Numerical Analysis Support.  for data processing
6). speed
7). Application delivery.  Final product as an application for others to
use.

I know this is a bit much for a single person development, but I would
like to take a shot at developing it using a language that can handle
the task.  I would definitely prefer not to have to start over in a new
language half way through.

At the moment, I am leaning towards using Java because of the cross
platform and new 2D API support.  But Python, I really like and its
easier to program using Python.

I would appreciate any comments on any aspect of this development.
Please only serious commentary.  I would like to use the best language
for the job.

Thanks very much.

-anthony wilson
http://home.earthlink.net/`wilsona
mailto:wilsona@earthlink.net
mailto:alwkappa@ThinkApple.com




From cbarker@jps.net  Mon Apr  5 21:40:26 1999
From: cbarker@jps.net (Chris Barker)
Date: Mon, 05 Apr 1999 13:40:26 -0700
Subject: [Matrix-SIG] Re: Using Python or Java for data analysis
References: <199904030602.BAA29297@python.org>
Message-ID: <37091FBA.81B50B2F@jps.net>

This is a reply to anthony wilson's request for comments.

First a bit about where I am coming from:

I have recently started using Python quite a bit, and like it a lot. I
am hoping that I will eventually be able to use it for numerical
analysis/number crunching in much the same way I use MATLAB now, except
with the ability to distribute apps that are cross platform (Linux,
Mac-OS, Windows, and plus ?)

I have no experience with JAVA.

First to address your questions, from the Python point of view:

>1).  File Input parsing into some usable form

Python's string handling routines make this pretty easy, and I am
starting to work on a file scanning module (something like MATLAB's
fscanf) that would make it even easier (and faster). Let me know if you
would like to work with me on this.

>2).  2 -D plotting.  This would also include interactive labeling and
such.

This is the tough one. I have yet to find a plotting package for Python
that works on the Mac. There are a couple that look like they could be
ported without much pain (Gist, for instance), but no one seems to have
done this yet. I need this desperately!

I am thinking about a writting a plotting package build on Tkinter's
canvas, for maximum portability.  Konrad Hinsen's TkPlotCanvas is a good
start to this (it's in his Scientific package)

Does anyone know the status of the SNOW project?

>3).  X-Y labeling
see above

>4).  GUI for the calculator front end

Tkinter would make this VERY easy. 
There are nifty GUI GUI-builders for JAVA that might make it even
easier, but I've never tried them.

>5).  Numerical Analysis Support.  for data processing

NumPy has most (if not all) of what you need, and adding more would not
be too
hard. I think Python has a real advantage over JAVA here.

>6). speed

With NumPy, Python would be as fast as anything, at least for the number 
crunching which is probably the only thing that matters. Tkinter is
plenty fast.

>7). Application delivery.  Final product as an application for others to
>use.

I'd like to see this easier to do with Python. You would probably have
to distribute Python, and all the modules that you need with your
app. This might make it a bit messier than it has to be. On Linux, yopu
could make a rpm out of it, and it would be pretty easy. On the mac, you
could make an installer that would be pretty easy, or even put
everything you need into the Resource fork, and make it look like a
stand alone app.

>At the moment, I am leaning towards using Java because of the cross
>platform and new 2D API support.  But Python, I really like and its
>easier to program using Python.

Well, Python is pretty darn Cross Platform as well, with the exception
of the plotting packages. Easier to program is worth a lot!

>I would appreciate any comments on any aspect of this development.
>Please only serious commentary.  I would like to use the best language
>for the job.

Good idea!

I'd like to add two points that I think make Python a better choice:

1) Scriptability. If your app will be only a "point and click" affair,
JAVA may be a better choice, but if you use Python, you get a complete
scripting/macro language in the package! My guess is that with the kind
of analysis you are talking about, your users might very well want to
enhance/extend the capabilities of your progam, and having the Python
interpreter as part of your app would be a great way to do this. Note
that if you were to write your app in C or C++, imbedding a Python
interpretter would still be a great idea!

2) there are a lot of folks using Python for similar things already, so
you would have a whole community of people (at least me, if no-one
else!) that you could work with on at least the individual pieces of
your program, such as the plotting routines, file I/O, and perhaps some
numerical routines. You would also be contributing to a nobel effort!


By the way, if you are thinking of going with JAVA, you could also
consider just sticking with C++ and WX Windows. It's not "write once,run
anywhere" but it could be "write once, compile anywhere" if you are
carefull about it!

Good luck,

-Chris

-- 
Christopher Barker,
Ph.D.                                                           
cbarker@jps.net                      ---           ---           ---
http://www.jps.net/cbarker          -----@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Water Resources Engineering       ------   @    ------   @   ------   @
Coastal and Fluvial Hydrodynamics -------      ---------     --------    
------------------------------------------------------------------------
------------------------------------------------------------------------


From Oliphant.Travis@mayo.edu  Tue Apr  6 07:59:03 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Tue, 6 Apr 1999 01:59:03 -0500
Subject: [Matrix-SIG] Needed extensions to Numerical Python to make a complete system.
Message-ID: <Pine.SGI.4.05.9904060108400.28731-100000@explorer.mayo.edu>

Over the next two years while I'm writing my thesis I plan on turning
Numerical Python into something that will let me replace MATLAB forever.
Hopefully with help it will become a system that will let others
also use this system instead of another proprietary and closed
interactive environment.

This has been talked about before, but apparently nobody has a lot of time
to really make it happen.  I really don't either but it's important
enough to me that I'm going to make sure it does happen.  In other words
I'm pretty committed.

I've been hesitant to actually claim that I'm going to do this since I
didn't know what kinds of tools were out there and I'm not a big expert on
the biggest hole in the sytem and that is a graphical output + User
interface builder combination that could replace MATLAB's featureful
design (What's available now is useful but the closest thing to what I
envision is Konrad's TkPlotCanvas and David's SNOW system -- something
to allow you to build a user interface to a graphically-interactive
system.)  

I've also not formally volunteered to head up a project like this because
I didn't know what kind of response it would receive.  After several
months of wishful-discussion on this topic, I have a pretty good idea of
how much coordination would be involved.  My idea is to simply do it and
let anyone interested know what I'm doing so they can offer welcome
suggestions or offer even more welcome contributions.  But, I'm not going
to let philosophical debates about what we should do deter me from
actually doing something.  I think the debates are useful and I've learned
from participating in them.  I will try to make the packages as
Python-neutral as possible, but I won't sacrifice ease of use for that
dream.

As far as licensing goes, any wrappers to public domain code I produce
will be LGPL and any code I write will be GPL or LGPL.  I know this will
make some unhappy, but the reasons I've heard not to use variants of the
GPL have not been compelling for me given what I'm giving up by not using
the (L)GPL.  Of course if more people contribute to the code base then
those who contribute will have to discuss this issue with me.

What I envision is something like OCTAVE except built on a general scripting
language like Python (which is why I'm even bothering to
do this at all and not just using OCTAVE).  For this to happen I have made
a list of general areas that need to be addressed.  The code for most of
these items already exits.  What we need is Python interfaces.  These can
be generated by SWIG --- but only provided it does not produce a "clunky"
interface.  This may mean python code around the SWIG calls or else
hand-crafted C-wrappers.  

Areas for which I (we) need functions in my preference order.  I'm open
to the question of whether this should be in compiled code or in Python
code. Right now I'm leaning toward compiled code (since the code already
exists for the most part.)

1) root-finding of systems of non-linear equations
2) sparse matrices and methods (iterative)
3) iterative methods in linear algebra (conjugate gradient, etc.)
4) ordinary differential equations
5) optimization 
6) integration routines
7) signal/image processing (filter design, math morphology, volume
rendering)

8) Plotting + User interface building  (I know only a little here--just
minimal features I want in the end product.  David's Snow package
looks like it's headed in the right direction.)

9) Parallel solvers.

I'm keeping a list.  This is pretty generic so far which is what I'm
after at this point.  Code that is used in a variety of situations and
could be used as building blocks to solve larger problems. If you have
ideas send them. I'll be working on wrapping root finding code for the
next little while as it's what I need right now.   If you'd like to break
off a chunk let me know and I'll coordinate your efforts.  

If you are sitting on code that is involved in any of the above areas 
and would like it to be a part of a general package then send it my way or
post it here and it can become part of the package.

The time line I envision right now is about two years if I'm the only one
who works on it.  With help that could become significantly lower.  

Best to all of your endeavors.

Travis Oliphant



From Jack.Jansen@cwi.nl  Tue Apr  6 10:07:31 1999
From: Jack.Jansen@cwi.nl (Jack Jansen)
Date: Tue, 06 Apr 1999 11:07:31 +0200
Subject: [Matrix-SIG] Re: [Pythonmac-SIG] Using Python or Java for data analysis(no flame wars please)
In-Reply-To: Message by "Anthony L. Wilson" <wilsona@earthlink.net> ,
 Fri, 02 Apr 1999 15:47:14 -0500 , <37052CD1.C31620EA@thinkapple.com>
Message-ID: <UTC199904060907.LAA11231.jack@trawler.cwi.nl>

I think it's almost a toss-up whether to use Python or Java. JPython
isn't an option for this problem, I think (it _is_ for many other
problems), as it doesn't have the plethora of modules (like NumPy)
that Python has.

Python has NumPy as a strong point, and I don't know about similar
packages for Java. Python has the Mac-implementation of Tkinter as a
weak point, somehow Tk-applications always feel clunky on the mac (but 
then, Java applications aren't exactly first class Mac citizens
either). On the rest of the questions the languages score about the
same (although I don't know how easy it is to create applications from 
Java. For Python it is a simple drag-and-drop since 1.5.2b1).

Maybe you should just pick the language you feel most comfortable with...
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl      | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm 


From Jack.Jansen@cwi.nl  Tue Apr  6 10:26:03 1999
From: Jack.Jansen@cwi.nl (Jack Jansen)
Date: Tue, 06 Apr 1999 11:26:03 +0200
Subject: [Matrix-SIG] Re: [Pythonmac-SIG] Re: Using Python or Java for data analysis
In-Reply-To: Message by Chris Barker <cbarker@jps.net> ,
 Mon, 05 Apr 1999 13:40:26 -0700 , <37091FBA.81B50B2F@jps.net>
Message-ID: <UTC199904060926.LAA11637.jack@trawler.cwi.nl>

Recently, Chris Barker <cbarker@jps.net> said:
> >7). Application delivery.  Final product as an application for others to
> >use.
> 
> I'd like to see this easier to do with Python.

*STILL* easier??!? You mean "drag and drop script onto
BuildApplication" isn't easy enough?!??!?!?

(seriously: since 1.5.2b1 this has indeed become simple drag and
drop. Now if you'd have said this last year you would have been right, 
but not any more...:-)
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl      | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm 


From david_ascher@yahoo.com  Tue Apr  6 11:58:30 1999
From: david_ascher@yahoo.com (David Ascher)
Date: Tue, 6 Apr 1999 03:58:30 -0700 (PDT)
Subject: [Matrix-SIG] Re: [Pythonmac-SIG] Using Python or Java for data analysis(no flame wars please)
Message-ID: <19990406105830.24871.rocketmail@web603.mail.yahoo.com>


--- Jack Jansen <Jack.Jansen@cwi.nl> wrote:
> I think it's almost a toss-up whether to use Python
> or Java. JPython
> isn't an option for this problem, I think (it _is_
> for many other
> problems), as it doesn't have the plethora of
> modules (like NumPy)
> that Python has.
> 
> Python has NumPy as a strong point, and I don't know
> about similar
> packages for Java. 

I would like to remind folks of Tim Hochberg's effort
called JNumeric.  I haven't heard much recently about
it, but it's IMHO a very worthwhile project.  

Mailing list archives are at:

http://www.egroups.com/list/jnumeric/

--david ascher

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



From wilsona@earthlink.net  Tue Apr  6 15:43:51 1999
From: wilsona@earthlink.net (Anthony L. Wilson)
Date: Tue, 06 Apr 1999 10:43:51 -0400
Subject: [Matrix-SIG] Python Data Analysis and Plotting
Message-ID: <370A1DA7.CD01617@thinkapple.com>

This is a follow-up message to the response to the topic "Using Python
or Java for Data Analysis"

It seems that there are two promising projects that may be of use for
me: Snow and Piddle.  I am glad to see some work is still on-going in
this area.  In looking at the other packages(
http://www.python.org/topics/scicomp/plotting.html ), I could not find
one that would fit the bill for running on both Linux and Mac OS.  The
main reason for inquiring about plotting and such, is to create a set of
tools that would complement MacSpice(
http://home.earthlink.net/~wilsona/macspice.html) for plotting data and
producing presentation quality output.  Yes, I know I could use Matlab,
Igor Pro, IDL from Research Systems, Inc., or Excel( Arghh!!!), but I
wanted something that would be portable across platforms (MacOS,
Linux/Unix, Windows) as these are the machines I use most for my real
work: circuit simulation, and freely available.

Snow
------
It seems Snow, developed by David Ascher, is further along in
development for producing output and backend renderers. Thanks for the
pointer David( http://starship.python.net:9673/crew/da/Snow ).  I liked
the sample files.  They seem to be able to produce the multiple formats
that I am looking for with the multiple axis style.  I will try to set
this up on my Linux machine and test a few things.  If this works, I'll
look into setting it up on my Mac.  The big hurdle for the Mac will be
the use of PyPDF and PDFlib
(http://www.ifconnection.de/~tm/software/pdflib/index.html ) that is
used by Snow.  Any one planning/doing/done work in this area?? Let me
know.

Questions on Snow:
1.  any comments on pursuing this for the Mac?  What do I need to set
everything up?  i.e. MacPython Source, PIL source, PDFlib source,
extension module setup, etc.
2.  Does Snow require PDFlib to produce GIF, JPEG, and PNG pictures or
is this supported by PIL?

Piddle
-----
Piddle, developed by Joe Strout ( http://www.strout.net/python/piddle/ )
is taking a different approach by making an independent graphics layer
that sits on top of the platform specific calls( i.e. backends ).  I
like this package because of the native calls and MacOS support.  Being
promoted as a package for producing 2-d graphics. With a plotting
package, Graphite, just getting started, this has potential also.  Also,
due to having native calls, it is mentioned that there may be some
capability for interaction by the user.  This would be a plus.  The
capability to annotate after the plot is rendered would be a big plus.
But there is only a Quickdraw backend available at the moment.  I'll try
this one after I look at Snow.

Question on Piddle:
1. Any time frame on the other backends?
2.  What are the requirements for Piddle?
3.  What does Piddle use to produce its PDF output?

Both packages have some, but not all (at the moment) of what I am
looking for.  It would be good to couple the two.  Use Piddle as the
generic graphics layer( for native on-Screen drawing ) and Snow as the
backend for producing the multiple output.  I doubt if this is possible
in a merged development effort.  But once Piddle is further along I plan
to look at more closely.


Thanks for reponses.
-anthony wilson
http://home.earthlink.net/~wilsona
mailto:wilsona@earthlink.net
mailto:alwkappa@ThinkApple.com




From tom@spirit.gcrc.upenn.edu  Tue Apr  6 15:39:56 1999
From: tom@spirit.gcrc.upenn.edu (Tom Fenn)
Date: Tue, 06 Apr 1999 10:39:56 -0400
Subject: [Matrix-SIG] Re: Using Python or Java for data analysis (and plotting widget)
References: <199904060500.BAA12586@python.org>
Message-ID: <370A1CBC.2D3F3D3E@spirit.gcrc.upenn.edu>

The plotting library pgplot has a Tk output driver that should work on
any platform that Tk works on.

I have a very alpha, but usually working, Tkinter wrapper for this. I
added about 5 lines of code
to the ppgplot module, and have written some rough Python code to
encapsulate everthing.  I imagine that this will work on a Macintosh,
but note that you will need a fortran compiler, or an f2c program, to
build the pgplot plotting libraries.  I built the libraries on my dec
alpha using the current version of g77 and the DEC c compiler.

BTW, Has anyone been able to access the ppgplot web site recently?  The
code I have is version 0.0, and I'd like to make sure I have the most
recent version before I attempt submitting a patch.  However, my
connections always time out.

You can get to some relevant web pages from python.org by following the
scientific/graphics/plotting links.

Tom Fenn
Center for Cancer Pharmacology
University of Pennsylvania Medical School


From joe@strout.net  Tue Apr  6 16:16:19 1999
From: joe@strout.net (Joseph J. Strout)
Date: Tue, 6 Apr 1999 08:16:19 -0700
Subject: [Matrix-SIG] Re: Python Data Analysis and Plotting
In-Reply-To: <370A1DA7.CD01617@thinkapple.com>
Message-ID: <v04020a06b32fd43609d0@[204.210.35.169]>

At 7:43 AM -0700 04/06/99, Anthony L. Wilson wrote:

>Piddle
>-----
>Piddle, developed by Joe Strout ( http://www.strout.net/python/piddle/ )

To be fair, PIDDLE is being developed by a team of people.  I'm merely
hosting the web pages and writing the QuickDraw backend.

>But there is only a Quickdraw backend available at the moment.

The PostScript backend is also nearly done, and has replicated the sample
outputs posted on the PIDDLE page, but I haven't linked it up yet.

>Question on Piddle:
>1. Any time frame on the other backends?

In addition to the QuickDraw and PostScript backends, we have folks on the
team working on Tk, Windows, and PDF backends. These should be done in the
next week or two.

>2.  What are the requirements for Piddle?

Python 1.5.2(b1), though that could be relaxed if necessary (we're using
the new list .extend method in a place or two).  That's all that is
required to use Piddle with PostScript and PDF, I believe.  The QuickDraw
version requires QuickDraw; the Tk version requires Tkinter; the Windows
version works only under Windows.  Also planned, but not yet implemented,
are a PIL version that draws directly to a PIL pixel map, and a GIF backend
that writes to a GIF file (though you could do this via PIL, if we get that
done first).

>3.  What does Piddle use to produce its PDF output?

It writes PDF directly via its PDF backend.

>Both packages have some, but not all (at the moment) of what I am
>looking for.  It would be good to couple the two.  Use Piddle as the
>generic graphics layer( for native on-Screen drawing ) and Snow as the
>backend for producing the multiple output.

David's involved in the development of PIDDLE, and I'm keeping up on the
development of Snow, so it is indeed possible that these two will get
together somehow.

Cheers,
-- Joe
,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'


From david_ascher@yahoo.com  Tue Apr  6 16:48:36 1999
From: david_ascher@yahoo.com (David Ascher)
Date: Tue, 6 Apr 1999 08:48:36 -0700 (PDT)
Subject: [Matrix-SIG] Re: Python Data Analysis and Plotting
Message-ID: <19990406154836.22378.rocketmail@web604.mail.yahoo.com>

--- "Anthony L. Wilson" <alwkappa@thinkapple.com> wrote:
> This is a follow-up message to the response to the topic "Using Python
> or Java for Data Analysis"
> 
> It seems that there are two promising projects that may be of use for
> me: Snow and Piddle.  I am glad to see some work is still on-going in
> this area.  In looking at the other packages(
> http://www.python.org/topics/scicomp/plotting.html ), I could not find
> one that would fit the bill for running on both Linux and Mac OS.  The
> main reason for inquiring about plotting and such, is to create a set of
> tools that would complement MacSpice(
> http://home.earthlink.net/~wilsona/macspice.html) for plotting data and
> producing presentation quality output.  Yes, I know I could use Matlab,
> Igor Pro, IDL from Research Systems, Inc., or Excel( Arghh!!!), but I
> wanted something that would be portable across platforms (MacOS,
> Linux/Unix, Windows) as these are the machines I use most for my real
> work: circuit simulation, and freely available.
> 
> Snow
> ------
> It seems Snow, developed by David Ascher, is further along in
> development for producing output and backend renderers. Thanks for the
> pointer David( http://starship.python.net:9673/crew/da/Snow ).  I liked
> the sample files.  They seem to be able to produce the multiple formats
> that I am looking for with the multiple axis style.  I will try to set
> this up on my Linux machine and test a few things.  If this works, I'll
> look into setting it up on my Mac.  The big hurdle for the Mac will be
> the use of PyPDF and PDFlib
> (http://www.ifconnection.de/~tm/software/pdflib/index.html ) that is
> used by Snow.  Any one planning/doing/done work in this area?? Let me
> know.

I plan on replacing the use of PDFlib with PDFgen, a Python-only framework
being developed by Andy Robinson.  In fact I already have a back-end for Snow
which uses PDFgen, but am waiting for release until PDFgen is upgraded to
include such features as rotated text and color control.  I don't expect
this to be a long-term problem.  In the meantime the PS/EPS back-end should
work fine on the mac.

> Questions on Snow:
> 1.  any comments on pursuing this for the Mac?  What do I need to set
> everything up?  i.e. MacPython Source, PIL source, PDFlib source,
> extension module setup, etc.

It depends on which back-end you wish to use.  For PS/EPS, all you
should need is NumPy. For bitmap output, PIL binaries should be ok
(but I don't know where they are -- you may need PIL 1.0b1 or later).

For PDF, I'd recommend waiting until PDFgen is available.

See comments below on a GUI/interactive version and the issues involved.

> 2.  Does Snow require PDFlib to produce GIF, JPEG, and PNG pictures or
> is this supported by PIL?

The latter.  PIL is great. =)

FYI#1: PIDDLE is quite promising -- I plan to provide a PIDDLE back-end
to Snow at some point -- there are some things which Snow needs which
Piddle doesn't provide in version 1.0 (such as arbitrary rotation of text
and clipping), but that won't be a problem for many plots.  

In other words, Snow and Piddle aren't mutually incompatible, and Piddle is probably
going to be a very good way to get Snow output on the mac (either the QD or Tkinter
back-end to piddle).  I'm willing to remove my back-ends and plug in Piddle if/when 
it's an appropriate replacement.  I haven't yet started work on said back-end.  (at
this point, I think that there are enough back-ends for Snow to be a good proof-of-
concept of the back-end architecture -- more urgent work lies elsewhere).

FYI#2: There is a very undocumented Piddle-like set of classes in Snow, which has
a similar approach but slightly different API, with more emphasis on multiple 
coordinate sets and "state-setting" objects, paths as 'higher-class' objects than in 
PIDDLE, etc.  Not at all to claim that the code in popy.py and *Device.py in Snow
is better than Piddle -- just a slightly different approach.

FYI#3: on the GUI front I have an PyOpenGL back-end for snow which is not ready for
distribution but which I've used in the past as part of a GUI for an interactive
function plotter (shown at the last IPC conference), and I may add a Tkinter-only
back-end if I can't fit the Piddle+Tk system in it neatly. My personal plans are to
build up a GUI which uses Tkinter for buttons and menus and the like and to use
PyOpenGL in a Tk window for the output/mouse input.  I find OpenGL to be both fast
and very high quality.  The only problem with OpenGL is that there is currently no
version of Togl (the OpenGL in a Tk widget widget) for the Mac.

Also FYI -- simple back-ends like PDFgen, PIL, and PS, take about 2 hours to get
90% of the functionality.  The part of the back-end which allows interactivity
is not yet that well defined.  The part of the back-end which knows about 3-D is
nonexistent.

Further along the way lie plans for a GUI based on Swing+Java2D (or maybe 3D) output
on top of JPython.

I'd be curious to hear of any progress in getting Snow to work on the Mac,
and I'll try to help with such efforts, but I don't have access to a programming
setup on the mac, and my Mac hacking days predate my Python era.

--david

PS: I am hoping to have quite a bit more time to devote to Snow in April/May.
    Expect to see the beginning of doc, code cleanup, and more graph types.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



From Oliphant.Travis@mayo.edu  Sun Apr 11 08:39:33 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Sun, 11 Apr 1999 02:39:33 -0500 (CDT)
Subject: [Matrix-SIG] Version 0.10 of minpack module is ready.
Message-ID: <Pine.LNX.4.04.9904110221070.7997-100000@us2.mayo.edu>

I just want to let interested people know that I have a working version a
wrapper for the nonlinear N-variable root finder in the FORTRAN package
minpack. I won't post it generally until I have several more of the
functions from that package incorporated (including a minimization routine
for the sum of squares of M nonlinear functions in N variables based on
the Levenberg-Marquardt algorithm). 

The routine is called fsolve in Python and takes as arguments a callable
object (function, method) and an intial guess sequence.  The callable
object is a function of N-variables.  Fsolve tries to find the sequence
for which the function returns zero.

I'm looking for people who are interested in getting alpha versions
of these kinds of tools for testing.  I'm more interested in finding
someone who wants to use this example code to get started  wrapping up
functions like LSODE from ODEPACK.

Send me mail if you are interested in the code, now.  I'll post it
generally, when I've added a bit more.  It may be a week or two.







From vanandel@atd.ucar.edu  Mon Apr 12 17:24:05 1999
From: vanandel@atd.ucar.edu (Joe Van Andel)
Date: Mon, 12 Apr 1999 10:24:05 -0600
Subject: [Matrix-SIG] Re: SWIG NumPy interfaces
In-Reply-To: Your message of Mon, 12 Apr 1999 01:00:38 -0400.
 <199904120500.BAA12906@python.org>
Message-ID: <199904121624.KAA15138@stout.atd.ucar.edu>

This is a multipart MIME message.

--==_Exmh_-12996654300
Content-Type: text/plain; charset=us-ascii

Reply-To: vanandel@ucar.edu
Cc:  pascucci <pascucci@cs.utexas.edu>
Fcc: 
--------
Here's an example of what I use.  The next release of EGCS may actually 
support templates well enough to use CXX from the LLNL distribution, 
but for now SWIG is what I use.

Joe VanAndel            Internet: vanandel@ucar.edu
National Center for     Web: http://www.atd.ucar.edu/~vanandel/home.html
Atmospheric Research



--==_Exmh_-12996654300
Content-Type: text/plain ; name="IIR_Filter.i"; charset=us-ascii
Content-Description: IIR_Filter.i

%module IIR_Filter
%{
#include "IIR_Filter.h"
#include "FloatTuple.h"
%}

%include "numpy_typemaps.i"

%typemap(python,in) float* TUPLE (float *temp) {
    int i;
    int cnt;
    if (PyTuple_Check($source)) {
    	cnt = PyTuple_Size($source);
    	temp = new float[cnt];
    	for (i=0; i < cnt; ++i) {
    	    temp[i] = PyFloat_AsDouble(PyTuple_GetItem($source, i));
    	}
    	$target = temp;
    } else {
    	 PyErr_SetString(PyExc_TypeError, "expected a tuple");	
    	 return NULL;
    }
}
%include "FloatTuple.h"





class IIR_Filter {
      public:
      	IIR_Filter(int, float, FloatTuplePtr);

    	PyObject *filter(PyArrayObject *INPUT_2D,   // I
		         PyArrayObject *INPUT_2D);   // Q
};

--==_Exmh_-12996654300
Content-Type: text/plain ; name="numpy_typemaps.i"; charset=us-ascii
Content-Description: numpy_typemaps.i

%typemap(python,in) PyArrayObject *INPUT
{
    $target = (PyArrayObject *)$source;    
}

%typemap(python,in) PyArrayObject *INPUT_1D
{
    $target = (PyArrayObject *)$source;    
    if ($target->nd != 1) {
        PyErr_SetString(PyExc_TypeError, "must be 1D array");
        return NULL;
    }
}

%typemap(python,in) PyArrayObject *INPUT_2D
{
    $target = (PyArrayObject *)$source;    
    if ($target->nd != 2) {
    //	printf("%s: num dim = %d\n", "$target", $target->nd);
        PyErr_SetString(PyExc_TypeError, "must be 2D array");
        return NULL;
    }
}

// pass 2D array of double
// by  Dr. Les Schaffer les@designspring.com

%typemap(python, in) double ** {
	 
	PyArrayObject *arr;    /* will point to our array object.      */
	PyObject ** op;        /* pointer to pointer to array object   */
                               /* cast as PyObject;                    */
			       /* (needed by PyArray_As2d).            */

	int d1, d2, type;      /* ints neeed by PyArray_As2D.          */
	char ***ptr;           /* need by PyArray_As2D.                */
                             
	double ** arrayPtr_2D; /* this is our double ** array pointer. */
                               /* C extensions can then access         */
                               /* arbitrary sized 2D arrays as         */
                               /* arrayPtr[i][j].                      */

	/* point ptr to the address of ArrayPtr_2D. */
	/* PyArray_As2D will then place in it a     */
        /* char **  pointer aimed at a set of       */
        /* pointers  to the rows of our array.      */
	ptr = (char ***) & arrayPtr_2D;

	/* here is our array object from caller	*/
	arr = (PyArrayObject *) $source;   

	/* point op at our array object pointer */
	op = (PyObject **)&arr;

	/* i use double almost always */
	type = (int) PyArray_DOUBLE;   

	/* now let PyArray_As2D re-arrange, if necessary (?),  */
	/* our array and set the pointers to the rows of array */
	PyArray_As2D( op, ptr, &d1, &d2, type); 
	
	/* done. hand arrayPtr2D to our C ext */
	$target = arrayPtr_2D; 
}


%typemap(python,out) PyObject * {
    $target = $source;
}

// grab a 12 element array from a Python tuple

%typemap(python,in) float[12] (float temp[12]){
    int i;
    if (PyTuple_Check($source)) {
    	if (!PyArg_ParseTuple($source, "ffffffffffff",
	   temp, temp+1, temp+2, temp+3,
	   temp+4, temp+5, temp+6, temp+7,
	   temp+8, temp+9, temp+10, temp+11)) {
	   PyErr_SetString(PyExc_TypeError, "tuple must have 12 elements");
	       return NULL;
										       }
	$target = &temp[0];
    } else {
    	PyErr_SetString(PyExc_TypeError, "expected a tuple");	
    	  return NULL;
    }   
}

%typemap(python,in) float[13] (float temp[13]){
    int i;
    if (PyTuple_Check($source)) {
    	if (!PyArg_ParseTuple($source, "fffffffffffff",
	   temp, temp+1, temp+2, temp+3,
	   temp+4, temp+5, temp+6, temp+7,
	   temp+8, temp+9, temp+10, temp+11,
	   temp+12 )) {
	   PyErr_SetString(PyExc_TypeError, "tuple must have 13 elements");
	       return NULL;
										       }
	$target = &temp[0];
    } else {
    	PyErr_SetString(PyExc_TypeError, "expected a tuple");	
    	  return NULL;
    }   
}

%typemap(python,in) float[15] (float temp[15]){
    int i;
    if (PyTuple_Check($source)) {
    	if (!PyArg_ParseTuple($source, "fffffffffffffff",
	   temp, temp+1, temp+2, temp+3,
	   temp+4, temp+5, temp+6, temp+7,
	   temp+8, temp+9, temp+10, temp+11,
	   temp+12, temp+13, temp+14)) {
	   PyErr_SetString(PyExc_TypeError, "tuple must have 15 elements");
	       return NULL;
										       }
	$target = &temp[0];
    } else {
    	PyErr_SetString(PyExc_TypeError, "expected a tuple");	
    	  return NULL;
    }   
}


--==_Exmh_-12996654300
Content-Type: text/plain ; name="FloatTuple.cc"; charset=us-ascii
Content-Description: FloatTuple.cc

#include <stdio.h>    // for NULL
#include "FloatTuple.h"

FloatTuple::FloatTuple(int cnt, float *tuple)
{
    values_ = tuple;    // we're inheriting this memory
    numFloats_ = cnt;
}
FloatTuple::~FloatTuple()
{
    delete values_;
    values_ = NULL;
    numFloats_= 0;
}

    




--==_Exmh_-12996654300
Content-Type: text/plain ; name="FloatTuple.h"; charset=us-ascii
Content-Description: FloatTuple.h

#ifndef FloatTupleH
#define FloatTupleH
class FloatTuple {
 public:
    FloatTuple(int cnt, float *TUPLE);
    ~FloatTuple();
    int numFloats_;
    float *values_;

    
};
typedef FloatTuple* FloatTuplePtr;

#endif
    



    

--==_Exmh_-12996654300--




From vanandel@ucar.edu  Tue Apr 13 21:40:06 1999
From: vanandel@ucar.edu (Joe Van Andel)
Date: Tue, 13 Apr 1999 14:40:06 -0600
Subject: [Matrix-SIG] problem building LLNL11 Graphics/Gist
Message-ID: <199904132040.OAA24410@stout.atd.ucar.edu>

On Solaris 2.6 (sparc), with python 1.5.2b1, using egcs-1.1.1,
 the Gist library won't load properly, because of the error:
>>> import Numeric
>>> import gist
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/local/lib/python1.5/site-packages/gist/gist.py", line 5, in ?
    from gistC import *
ImportError: ld.so.1: python: fatal: relocation error: file /local/lib/python1.5/site-packages/gistCmodule.so: symbol PyArray_Return: referenced symbol not found

I tried linking gistCmodule.so against
_numpymodule.so, where PyArray_Return is defined, but it didn't help.

I had this working with an earlier release of LLNL, but I don't recall what I 
patched.

Any helpful ideas?



Joe VanAndel  		Internet: vanandel@ucar.edu
National Center for	http://www.atd.ucar.edu/~vanandel/home.html
Atmospheric Research




From zcm@llnl.gov  Tue Apr 13 22:28:41 1999
From: zcm@llnl.gov (Zane Motteler)
Date: Tue, 13 Apr 99 14:28:41 PDT
Subject: [Matrix-SIG] Re: problem building LLNL11 Graphics/Gist
In-Reply-To: <199904132040.OAA24410@stout.atd.ucar.edu>
Message-ID: <v03007809b339067414bb@[128.115.36.161]>

Joe,

You wrote:

>On Solaris 2.6 (sparc), with python 1.5.2b1, using egcs-1.1.1,
> the Gist library won't load properly, because of the error:
>>>> import Numeric
>>>> import gist
>Traceback (innermost last):
>  File "<stdin>", line 1, in ?
>  File "/local/lib/python1.5/site-packages/gist/gist.py", line 5, in ?
>    from gistC import *
>ImportError: ld.so.1: python: fatal: relocation error: file
>/local/lib/python1.5/site-packages/gistCmodule.so: symbol PyArray_Return:
>referenced symbol not found
>
>I tried linking gistCmodule.so against
>_numpymodule.so, where PyArray_Return is defined, but it didn't help.
>
>I had this working with an earlier release of LLNL, but I don't recall what I
>patched.

It sounds to me as if you need import_array. Without this,
gistC is unable to access the functions in _numpymodule. (In
general, .so files can't access eqach other's symbols.)

What you need, right before the assignment to PyOS_InputHook,
is

#ifdef import_array
   import_array()
#endif

This should fix the problem.

Zane

--------------------
Zane C. Motteler, Ph. D.
   Professor Emeritus of Computer Science and Engineering
   California Polytechnic State University, San Luis Obispo
   zmottel@calpoly.edu
Currently:
   Computer Scientist
   Lawrence Livermore National Laboratory
   P O Box 808, L-038 (Street address 7000 East Avenue, L-038)
   Livermore, CA 94551-9900
   zcm@llnl.gov  925/423-2143, FAX 925/423-9969




From Oliphant.Travis@mayo.edu  Tue Apr 13 22:46:50 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Tue, 13 Apr 1999 16:46:50 -0500 (CDT)
Subject: [Matrix-SIG] Interfaces to some common FORTRAN routines.
Message-ID: <Pine.LNX.4.04.9904131632080.13377-100000@us2.mayo.edu>

I'm making available my interface to the FORTRAN package MINPACK at
http://oliphant.netpedia.net
under the name package called multipack-0.3

There is a Linux i386 binary and a Source RPM package along with a
tarball.  You need a fortran compiler to compile the code.  That's the
cleanest way to do it on my system.  Calling fortran from C can be system
dependent and I assume the underscore convention.

My plan is to include ODEPACK, QUADPACK, and others in this module.  I'm
currently working on putting QUADPACK and ODEPACK in.  If anyone has
experience with these routines and can offer suggestions as to how you
would like to interface with them, I'd love to hear about it.  

This list seems to have quieted down a bit with regard to getting some
of these codes into Numerical Python.  Has interest in using
Numerical Python subsided, is everyone just happy with where things stand,
or just busy doing work with it?

Comments and suggestions welcome,



--------------------------------------------------
Travis Oliphant           200 First St SW          
    	                  Rochester MN 55905       
Ultrasound Research Lab	  (507) 286-5293           
Mayo Graduate School	  Oliphant.Travis@mayo.edu 



From dubois1@llnl.gov  Tue Apr 13 23:38:34 1999
From: dubois1@llnl.gov (Paul F. Dubois)
Date: Tue, 13 Apr 1999 15:38:34 -0700
Subject: [Matrix-SIG] Interfaces to some common FORTRAN routines.
Message-ID: <001701be85fe$5db3bb80$f4160218@c1004579-c.plstn1.sfba.home.com>

I don't normally preannounce products but since you ask, I am nearing
completion on a Python module called PyFort. PyFort translates an input
format which is highly similar to F90 interface blocks into Python module
glue. Although I know others have tools that use SWIG, my feeling was the
Fortran programmers need something that is more or less in their language
and which at least has the potential to someday handle real F90 interfaces.

PyFort is, of course, being written in 100% Pure Python.

Here is the input to my test routine, for example:
! Sample interface description file for Python/Fortran connection tool.
! Paul F. Dubois dubois1@llnl.gov
! More than one module is allowed, this file just has one.

module testpyf
    ! testpyf contains doit, times, and bang and others
    function doit(x)
        ! y = doit(x) returns y = x**2
        ! x must be a Python float.
        doubleprecision x !scalar float
        doubleprecision doit !returns scalar float
    end

    subroutine times(x, y, n, w)
       ! times(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n
       doubleprecision, intent(in)::  x(n), y(n) ! must have size n
       doubleprecision, intent(out):: w(n)
       integer n
    end subroutine

    subroutine ctimes(x, y, n, w)
       !for complex x, y, w, ctimes(x, y, n, w) sets w(i) = x(i) * y(i), i =
1, n
       complex, intent(in)::  x(n), y(n) ! must have size n
       complex, intent(out):: w(n)
       integer n
    end subroutine

    function bang( r, ra, n, k, c, t)
        integer n, k
        complex c(2)
        real r, ra(n), bang
        real, intent(temporary):: t(n, k)
    end function bang

    function two (a, n, m, k, b, c)
        real two
        integer n, m, k
        real a(n, m), b(m, k)
        real, intent(out):: c(n, k)
    end function two

    subroutine noreturn ()
    end subroutine noreturn

    function sarg (s, x)
 ! sarg(s) if s is 'yes', will return 1, otherwise 0
        integer, intent(out):: sarg, x(1)
        character*(*) s
    end subroutine sarg

end module testpyf

! Comments here are ignored

--- ok, that is the input.
The comments immediately after the subroutine signature are called "head
comments". Head comments become the doc string. A separate file is printed
giving the python calling sequence, as shown below. Right now this is for me
to use to debug pyfort, but cleaned up a little it will serve users as
documentation on how they call various routines. I haven't thought about
routines with arguments that are externals, although that would obviously be
a good thing.  The rules are pretty simple. The outputs are the routine
result if any followed by any of the Fortran arguments that had intent out
or inout.  If there is <= 1 output that is the result, otherwise you get a
tuple. The special intent "temporary" is used for "work arrays" so the
Python user need not create them a priori.

------------
Procedures in module testpyf

----------- doit ------------
y = doit(x) returns y = x**2
x must be a Python float.
Calling sequence: result = doit(x)
          doubleprecision, intent(out):: doit ()
          doubleprecision, intent(in):: x ()

----------- times ------------
times(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n
Calling sequence: w = times(x, y, n)
          doubleprecision, intent(in):: x (n)
          doubleprecision, intent(in):: y (n)
          integer, intent(in):: n ()
          doubleprecision, intent(out):: w (n)

----------- ctimes ------------
for complex x, y, w, ctimes(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n
Calling sequence: w = ctimes(x, y, n)
          complex, intent(in):: x (n)
          complex, intent(in):: y (n)
          integer, intent(in):: n ()
          complex, intent(out):: w (n)

----------- bang ------------

Calling sequence: result = bang(r, ra, n, k, c)
          real, intent(out):: bang ()
          real, intent(in):: r ()
          real, intent(in):: ra (n)
          integer, intent(in):: n ()
          integer, intent(in):: k ()
          complex, intent(in):: c (2)
          real, intent(temporary):: t (n, k)

----------- two ------------

Calling sequence: result, c = two(a, n, m, k, b)
          real, intent(out):: two ()
          real, intent(in):: a (n, m)
          integer, intent(in):: n ()
          integer, intent(in):: m ()
          integer, intent(in):: k ()
          real, intent(in):: b (m, k)
          real, intent(out):: c (n, k)

----------- noreturn ------------

Calling sequence: noreturn()

----------- sarg ------------
sarg(s) if s is 'yes', will return 1, otherwise 0
Calling sequence: result, x = sarg(s)
          integer, intent(out):: sarg ()
          character*(*), intent(in):: s ()
          integer, intent(out):: x (1)

-----Original Message-----
From: Travis Oliphant <Oliphant.Travis@mayo.edu>
To: matrix-sig@python.org <matrix-sig@python.org>
Date: Tuesday, April 13, 1999 2:51 PM
Subject: [Matrix-SIG] Interfaces to some common FORTRAN routines.


>
>I'm making available my interface to the FORTRAN package MINPACK at
>http://oliphant.netpedia.net
>under the name package called multipack-0.3
>
>There is a Linux i386 binary and a Source RPM package along with a
>tarball.  You need a fortran compiler to compile the code.  That's the
>cleanest way to do it on my system.  Calling fortran from C can be system
>dependent and I assume the underscore convention.
>
>My plan is to include ODEPACK, QUADPACK, and others in this module.  I'm
>currently working on putting QUADPACK and ODEPACK in.  If anyone has
>experience with these routines and can offer suggestions as to how you
>would like to interface with them, I'd love to hear about it.
>
>This list seems to have quieted down a bit with regard to getting some
>of these codes into Numerical Python.  Has interest in using
>Numerical Python subsided, is everyone just happy with where things stand,
>or just busy doing work with it?
>
>Comments and suggestions welcome,
>
>
>
>--------------------------------------------------
>Travis Oliphant           200 First St SW
>                      Rochester MN 55905
>Ultrasound Research Lab   (507) 286-5293
>Mayo Graduate School   Oliphant.Travis@mayo.edu
>
>
>_______________________________________________
>Matrix-SIG maillist  -  Matrix-SIG@python.org
>http://www.python.org/mailman/listinfo/matrix-sig
>
>



From vanandel@ucar.edu  Wed Apr 14 00:25:19 1999
From: vanandel@ucar.edu (Joe Van Andel)
Date: Tue, 13 Apr 1999 17:25:19 -0600
Subject: [Matrix-SIG] LLNL11 build problem.
Message-ID: <199904132325.RAA01573@stout.atd.ucar.edu>

I've found a problem with the build procedure for LLNL11. When building
'Numeric', it installs arrayobject.h in
/local/include/python1.5/numeric/arrayobject.h

When LLNLDistribution11/Graphics is built, the compilation of Gist only 
searches /local/include/python1.5
i.e.:

gcc   -I/usr/local/lib/yorick/1.4/h -g -O2 -I/local/include/python1.5 -I/local/include/python1.5 -DHAVE_CONFIG_H -c ./Gist/Src/gistCmodule.c

In my case, I was accidently referencing an obsolete version of 
arrayobject.h, that had not been over-written.  It was lacking the
'import_array' definition, so I couldn't use the Gist module I had just 
built.

Also, I'm seeing a compile warning:

./Gist/Src/gistCmodule.c:88: warning: `PyFPE_END_PROTECT' redefined
/local/include/python1.5/pyfpe.h:169: warning: this is the location of the previous definition


Finally, I'd delete the 'install' target in the generated Makefile, if 
possible.  It installs gistCmodule.so arrayfnsmodule.so in

/local/lib/python1.5/site-packages,

where 'installthis.py' puts the shared libraries in the
gist and arrayfcns subdirectories.

This only causes confusion if you accidently type 'make install' (a 
hard habit to break!), because then you can end up with 2 different 
versions of the same file.





Joe VanAndel  		Internet: vanandel@ucar.edu
National Center for	http://www.atd.ucar.edu/~vanandel/home.html
Atmospheric Research






From Oliphant.Travis@mayo.edu  Wed Apr 14 07:36:48 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Wed, 14 Apr 1999 01:36:48 -0500 (CDT)
Subject: [Matrix-SIG] Some optimization routines.
Message-ID: <Pine.LNX.4.04.9904140131200.13934-100000@us2.mayo.edu>

A while back there was talk about optimization routines.  I just
downloaded a lot of them from the subdirectory /opt on netlib
(constrained, unconstrained, nonlinear ...) I would like to include an
appropriate set of these (eventually) in the multipack module that I'm
constructing.  

I'd like to start with one that minimizes a function of N variables and
am interested to hear what people on this list have to say about the
appropriateness of one algorithm versus another.  I know that's a hard
question given that optimization is so problem-dependent.  That's why I
eventually want to add a number of them.  So, what are the "good" ones.

Regards,

Travis




From ryszard@moldyn.com  Wed Apr 14 15:00:51 1999
From: ryszard@moldyn.com (Ryszard Czerminski)
Date: Wed, 14 Apr 1999 10:00:51 -0400 (EDT)
Subject: [Matrix-SIG] Some optimization routines.
In-Reply-To: <Pine.LNX.4.04.9904140131200.13934-100000@us2.mayo.edu>
Message-ID: <Pine.LNX.3.95.990414093906.691C-100000@mpc3>

As you pointed out performance and applicability of
various optimization routines is very much problem
dependent, therefore you need to look for "best" algorithms
(and implementations!) in different categories.

I comment here only on unconstrained, local minimization
problems:

general non-linear functions:

(1) derivatives not available - SIMPLEX and conjugate
    direction methods (but I do not know about their relative merit)
(2) first derivatives available - conjugate gradient
    (Polak-Ribiere variant)
(3) first and second derivatives available - Newton-Raphson

for least-square problems methods which exploit explicitely
structure of the objective function are more effective
e.g. Levenberg-Marquardt method

Above list is probably not very complete - even only
for unconstrained, local minimization problems. 

There is a very nice overview in
http://www-fp.mcs.anl.gov/otc/Guide/OptWeb.

Ryszard Czerminski         phone : (617)354-3124 x 10
Moldyn, Inc.               fax   : (617)491-4522
955 Massachusetts Avenue   e-mail: ryszard@moldyn.com
Cambridge MA, 02139-3180   http://www.moldyn.com

On Wed, 14 Apr 1999, Travis Oliphant wrote:

> 
> A while back there was talk about optimization routines.  I just
> downloaded a lot of them from the subdirectory /opt on netlib
> (constrained, unconstrained, nonlinear ...) I would like to include an
> appropriate set of these (eventually) in the multipack module that I'm
> constructing.  
> 
> I'd like to start with one that minimizes a function of N variables and
> am interested to hear what people on this list have to say about the
> appropriateness of one algorithm versus another.  I know that's a hard
> question given that optimization is so problem-dependent.  That's why I
> eventually want to add a number of them.  So, what are the "good" ones.
> 
> Regards,
> 
> Travis
> 
> 
> 
> _______________________________________________
> Matrix-SIG maillist  -  Matrix-SIG@python.org
> http://www.python.org/mailman/listinfo/matrix-sig
> 



From pearu@ioc.ee  Wed Apr 14 16:32:40 1999
From: pearu@ioc.ee (Pearu Peterson)
Date: Wed, 14 Apr 1999 18:32:40 +0300 (EETDST)
Subject: [Matrix-SIG] Python interfaces to cddlib, vode, and hybr[d,j]
Message-ID: <Pine.HPX.4.05.9904141751410.11023-100000@egoist.ioc.ee>

Hi,

In 
  http://koer.ioc.ee/~pearu/python/
you can find Python interfaces for the following C and FORTRAN libraries:

cddlib - solving enumeration problems for general convex polyhedron
vode   - Ordinary Differential Equation solver
fixpt  - interfaces to MINPACK functions hybrd and hybrj (F(x)=0 solvers)
         (I used them for finding fixed points, that's why 'fixpt'. In
          addition, I had plans to extend it with other packages like
          HOMPACK, etc, until Travis Oliphant's multipack came out).

They compile on Linux-i?86, Linux-Alpha, and HP-UX egcs (I don't have
access to other platforms.)

I wrote them for my work project and I didn't then worry about copyrights
and other stuff (docs). So, if there is any interest, I can certainly fix
these matters.

With regards,
	Pearu

Pearu Peterson <pearu@ioc.ee>, MSc, Researcher
Department of Mechanics and Applied Mathematics          http://koer.ioc.ee/~pearu/
Institute of Cybernetics at Tallinn Technical University Phone: (+372) 6204168
Akadeemia Rd. 21, 12618 Tallinn ESTONIA                  Fax:   (+372) 6204151
*** the nonvalidity of rigorous causality is necessary 
    and not just consistently possible (Heisenberg, 1925) ***



From KaliazinA@cardiff.ac.uk  Wed Apr 14 18:59:49 1999
From: KaliazinA@cardiff.ac.uk (Andrey Kaliazin)
Date: Wed, 14 Apr 1999 18:59:49 +0100
Subject: [Matrix-SIG] Some optimization routines.
References: <Pine.LNX.3.95.990414093906.691C-100000@mpc3>
Message-ID: <001201be86a0$9cee39e0$561afb83@engi.cf.ac.uk>

Hi  Travis,
you are doing a great job!

I've spent some time on these problems with many variables.
From 1 to ~200 (I'd like more, but my PC became too slow :)

When number of variables exceed 10-20, depending on a problem,
there is NO one best subroutine, definitely, and powerful second-order ones,
like BFGS, Newton-Raphson, etc, became less and less useful.
They are only good near the local extremum but you have to find it first.
Modern techniques for many-variables optimization are
1. Simulated Annealing (SA)
ASA <http://www.ingber.com/#ASA-INFO>
or SIMANN - both are in the OPT pack from NETLIB,
2. Genetic Algorithms (GA) - look for example at
<http://www-xdiv.lanl.gov/XCM/research/genalg/ga.html>
3. Of course general and specific N-dimensional Monte-Carlo methods.

Andy


----- Original Message -----
From: Ryszard Czerminski <ryszard@moldyn.com>
To: Travis Oliphant <Oliphant.Travis@mayo.edu>
Cc: <matrix-sig@python.org>


>
> As you pointed out performance and applicability of
> various optimization routines is very much problem
> dependent, therefore you need to look for "best" algorithms
> (and implementations!) in different categories.
>
> I comment here only on unconstrained, local minimization
> problems:
>
> general non-linear functions:
>
> (1) derivatives not available - SIMPLEX and conjugate
>     direction methods (but I do not know about their relative merit)
> (2) first derivatives available - conjugate gradient
>     (Polak-Ribiere variant)
> (3) first and second derivatives available - Newton-Raphson
>
> for least-square problems methods which exploit explicitly
> structure of the objective function are more effective
> e.g. Levenberg-Marquardt method
>
> Above list is probably not very complete - even only
> for unconstrained, local minimization problems.
>
> There is a very nice overview in
> http://www-fp.mcs.anl.gov/otc/Guide/OptWeb.
>
> Ryszard Czerminski         phone : (617)354-3124 x 10
> Moldyn, Inc.               fax   : (617)491-4522
> 955 Massachusetts Avenue   e-mail: ryszard@moldyn.com
> Cambridge MA, 02139-3180   http://www.moldyn.com
>
> On Wed, 14 Apr 1999, Travis Oliphant wrote:
>
> >
> > A while back there was talk about optimization routines.  I just
> > downloaded a lot of them from the subdirectory /opt on netlib
> > (constrained, unconstrained, nonlinear ...) I would like to include an
> > appropriate set of these (eventually) in the multipack module that I'm
> > constructing.
> >
> > I'd like to start with one that minimizes a function of N variables and
> > am interested to hear what people on this list have to say about the
> > appropriateness of one algorithm versus another.  I know that's a hard
> > question given that optimization is so problem-dependent.  That's why I
> > eventually want to add a number of them.  So, what are the "good" ones.
> >
> > Regards,
> >
> > Travis
> >
> >
> >
> > _______________________________________________
> > Matrix-SIG maillist  -  Matrix-SIG@python.org
> > http://www.python.org/mailman/listinfo/matrix-sig
> >
>
>
> _______________________________________________
> Matrix-SIG maillist  -  Matrix-SIG@python.org
> http://www.python.org/mailman/listinfo/matrix-sig
>





From Oliphant.Travis@mayo.edu  Wed Apr 14 19:44:16 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Wed, 14 Apr 1999 13:44:16 -0500 (CDT)
Subject: [Matrix-SIG] Polynomial root finding and handy ndgrid construction.
Message-ID: <Pine.LNX.4.04.9904141334180.16363-100000@us2.mayo.edu>

Here are some handy routines I've been using that others may have interest
in:

A polynomial root finder.

def roots(p):
        """r = roots(p) returns the roots of the polynomial defined in the
        sequence p: p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1] * x + p[n]
        """
        p = asarray(p)
        N = len(p.shape)
        if (len(p.shape) > 1):
                raise ValueError, "Input must be 1-D."

        nz = nonzero(p)
        if len(nz) == 0 :
                return zeros(p.shape)

        # Strip leading zeros and trailing zeros
        # Save trailing zeros as roots
        N = p.shape[0]
        p = p[nz[0]:nz[-1]+1]
        r = zeros(N-nz[-1]-1)

        # Form companion matrix (eigenvalues are roots)
        n = p.shape[0]
        if (n > 1):
                a = diag(ones(p.shape[0]-2),-1)
                a[0,:] = -p[1:]/p[0]
                r = concatenate((r,eig(a)[0]))

        return r


Here's a class that makes constructing N-D grids very easy from an
interactive session.  It overloads the slice selection mechanism so that
the output is the equivalent of what MATLAB's ndgrid function produces.

class NDgrid:
    def __getitem__(self,key):
        try:
	    size = []
	    for k in range(len(key)):
	        step = key[k].step
                if step == None:
                    step = 1.0
                size.append((key[k].stop - key[k].start)/(step*1.0))
	    nn = indices(size,'d')
	    for k in range(len(size)):
                step = key[k].step
                if step == None:
                    step = 1.0
                nn[k] = (nn[k]+key[k].start/(1.0*step))*step
	    return nn
        except:
            return arange(key.start,key.stop,key.step)
	    
    def __getslice__(self,i,j):
        return arange(i,j)


Usage:

>>> nd = NDgrid()   # I put this in my .pythonrc file

>>> nd[0:4:0.5]
array([ 0. ,  0.5,  1. ,  1.5,  2. ,  2.5,  3. ,  3.5])

>>> nd[0:4:0.5,0:5]
array([[[ 0. ,  0. ,  0. ,  0. ,  0. ],
        [ 0.5,  0.5,  0.5,  0.5,  0.5],
        [ 1. ,  1. ,  1. ,  1. ,  1. ],
        [ 1.5,  1.5,  1.5,  1.5,  1.5],
        [ 2. ,  2. ,  2. ,  2. ,  2. ],
        [ 2.5,  2.5,  2.5,  2.5,  2.5],
        [ 3. ,  3. ,  3. ,  3. ,  3. ],
        [ 3.5,  3.5,  3.5,  3.5,  3.5]],
       [[ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ],
        [ 0. ,  1. ,  2. ,  3. ,  4. ]]])


Regards,

Travis




From vanandel@ucar.edu  Thu Apr 15 15:43:24 1999
From: vanandel@ucar.edu (Joe Van Andel)
Date: Thu, 15 Apr 1999 08:43:24 -0600
Subject: [Matrix-SIG] patch - generalize arrayfns.interp to mulitple dimensions
Message-ID: <199904151443.IAA12414@stout.atd.ucar.edu>

This is a multipart MIME message.

--==_Exmh_19846673670
Content-Type: text/plain; charset=us-ascii

I just stumbled across the arrayfns.interp function:
   /* interp (y, x, z) treats (x, y) as a piecewise linear function
    * whose value is y [0] for x < x [0] and y [len (y) -1] for x >
    * x [len (y) -1]. An array of floats the same length as z is
    * returned, whose values are ordinates for the corresponding z
    * abscissae interpolated into the piecewise linear function.         */

It lives in

LLNLDistribution11/Graphics/Arrayfcns/Src/arrayfnsmodule.c

(Because I found this function, I didn't need to write my
function in 'C', and could write a fuzzy logic recognizer in about 40 lines of 
Python.)

As distributed, the input and output arrays can only have a single 
dimension.  I needed a more general version, and rather than reshaping 
my input and output arrays, I modified this routine to accept arrays 
with up to 'MAX_INTERP_DIMS (currently 6) dimensions.

With the (limited) testing I've done, the new version works just fine.

I've attached a context diff, and hope this change is accepted for the 
next release from LLNL.



Joe VanAndel  		Internet: vanandel@ucar.edu
National Center for	http://www.atd.ucar.edu/~vanandel/home.html
Atmospheric Research


--==_Exmh_19846673670
Content-Type: text/plain ; name="arrayfns.diff"; charset=us-ascii
Content-Description: arrayfns.diff

*** 1.1	1999/04/14 22:58:32
--- arrayfnsmodule.c	1999/04/15 14:14:16
***************
*** 6,11 ****
--- 6,13 ----
  #include <stdio.h>
  #include <stdlib.h>
  
+ #define MAX_INTERP_DIMS 6
+ 
  static PyObject *ErrorObject;
  
  /* Define 2 macros for error handling:
***************
*** 34,39 ****
--- 36,43 ----
  #define A_DIM(a,i) (((PyArrayObject *)a)->dimensions[i])
  #define GET_ARR(ap,op,type,dim) \
    Py_Try(ap=(PyArrayObject *)PyArray_ContiguousFromObject(op,type,dim,dim))
+ #define GET_ARR2(ap,op,type,min,max) \
+   Py_Try(ap=(PyArrayObject *)PyArray_ContiguousFromObject(op,type,min,max))
  #define ERRSS(s) ((PyObject *)(PyErr_SetString(ErrorObject,s),0))
  #define SETERR(s) if(!PyErr_Occurred()) ERRSS(errstr ? errstr : s)
  #define DECREF_AND_ZERO(p) do{Py_XDECREF(p);p=0;}while(0)
***************
*** 597,609 ****
         Py_DECREF(ay);
         Py_DECREF(ax);
         return NULL ;}
!    GET_ARR(az,oz,PyArray_DOUBLE,1);
     lenz = A_SIZE (az);
     dy = (double *) A_DATA (ay);
     dx = (double *) A_DATA (ax);
     dz = (double *) A_DATA (az);
!    Py_Try (_interp = (PyArrayObject *) PyArray_FromDims (1, &lenz, 
!       PyArray_DOUBLE));
     dres = (double *) A_DATA (_interp) ;
     slopes = (double *) malloc ( (leny - 1) * sizeof (double)) ;
     for (i = 0 ; i < leny - 1; i++) {
--- 601,614 ----
         Py_DECREF(ay);
         Py_DECREF(ax);
         return NULL ;}
!    GET_ARR2(az,oz,PyArray_DOUBLE,1,MAX_INTERP_DIMS);
     lenz = A_SIZE (az);
     dy = (double *) A_DATA (ay);
     dx = (double *) A_DATA (ax);
     dz = (double *) A_DATA (az);
!    /* create output array with same size as 'Z' input array */
!    Py_Try (_interp = (PyArrayObject *) PyArray_FromDims
!            (A_NDIM(az), az->dimensions, PyArray_DOUBLE));
     dres = (double *) A_DATA (_interp) ;
     slopes = (double *) malloc ( (leny - 1) * sizeof (double)) ;
     for (i = 0 ; i < leny - 1; i++) {

--==_Exmh_19846673670--




From Oliphant.Travis@mayo.edu  Fri Apr 16 16:24:12 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Fri, 16 Apr 1999 10:24:12 -0500 (CDT)
Subject: [Matrix-SIG] SegFault?
Message-ID: <Pine.LNX.4.04.9904161022020.20183-100000@us2.mayo.edu>

Does anybody else get a segfault when running:

>>> array(<anything>,0)

I know this is an incorrect calling sequence, I typed it in by mistake.

Does anyone else see this behavior?

Thanks,

Travis



From Oliphant.Travis@mayo.edu  Fri Apr 16 16:55:38 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Fri, 16 Apr 1999 10:55:38 -0500 (CDT)
Subject: [Matrix-SIG] SegFault?
Message-ID: <Pine.LNX.4.04.9904161043210.20240-100000@us2.mayo.edu>

The segfault mentioned previously happens whenever the second argument to
array is not a string.   This is because the output from
PyString_AsString(tpo) in array_array() in multiarraymodule.c does not
check for a NULL return.  

Forgot to mention.  My system is:

Python 1.5.2b2 (#1, Mar  9 1999, 17:40:28)  [GCC 2.7.2.3] on linux2

running LLNLDistribution11

I think the problem is that call to PyString_AsString does not
check conversion does not check to see if NULL is returned before
dereferencing the result.

Here is the patch to fix it:

*** multiarraymodule.c  Fri Apr 16 10:53:58 1999
--- multiarraymodule.c.orig     Fri Apr 16 10:52:18 1999
***************
*** 865,872 ****
                type = PyArray_NOTYPE;
        } else {
                tp = PyString_AsString(tpo);
!               if (tp == NULL) type = PyArray_NOTYPE;
!               else if (tp[0] == 0) type = PyArray_NOTYPE;
                else type = tp[0];
        }
  
--- 865,871 ----
                type = PyArray_NOTYPE;
        } else {
                tp = PyString_AsString(tpo);
!               if (tp[0] == 0) type = PyArray_NOTYPE;
                else type = tp[0];
        }
  




From cgw@fnal.gov  Fri Apr 16 17:07:08 1999
From: cgw@fnal.gov (Charles G Waldman)
Date: Fri, 16 Apr 1999 11:07:08 -0500 (CDT)
Subject: [Matrix-SIG] SegFault?
In-Reply-To: <Pine.LNX.4.04.9904161022020.20183-100000@us2.mayo.edu>
References: <Pine.LNX.4.04.9904161022020.20183-100000@us2.mayo.edu>
Message-ID: <14103.24620.86105.766538@buffalo.fnal.gov>

Travis Oliphant writes:
 > 
 > Does anybody else get a segfault when running:
 > 
 > >>> array(<anything>,0)

Yes, it's reproducible.  Due to a lack of sufficient type-checking in
the C code.
 > 
 > I know this is an incorrect calling sequence, I typed it in by mistake.

It's desirable that *no* incorrect calls generate segfaults!

Here's a patch:


--- Src/multiarraymodule.c	1999/04/16 15:53:26	1.1
+++ Src/multiarraymodule.c	1999/04/16 16:03:49
@@ -863,6 +863,10 @@
 	if (tpo == Py_None) {
 		type = PyArray_NOTYPE;
 	} else {
+		if (!PyString_Check(tpo)){
+			PyErr_SetString(PyExc_TypeError, "Invalid type for array");
+			return NULL;
+		}
 		tp = PyString_AsString(tpo);
 		if (tp[0] == 0) type = PyArray_NOTYPE;
 		else type = tp[0];


From Oliphant.Travis@mayo.edu  Fri Apr 16 18:02:09 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Fri, 16 Apr 1999 12:02:09 -0500 (CDT)
Subject: [Matrix-SIG] SegFault?
In-Reply-To: <14103.24703.436021.797569@buffalo.fnal.gov>
Message-ID: <Pine.LNX.4.04.9904161157410.20365-100000@us2.mayo.edu>

> I think that my patch is better because it signals an error to the
> user rather than accepting the garbage input.

It does signal the user, which is better.  The PyString_AsString does
the same check though so with Charles's patch we can use the macro version
PyString_AS_STRING() here.

Travis






From zaur.mail@usa.net  Sun Apr 18 20:12:35 1999
From: zaur.mail@usa.net (Zaur Nart)
Date: 18 Apr 99 19:12:35 MSD
Subject: [Matrix-SIG] array_map?
Message-ID: <19990418151235.26450.qmail@www0k.netaddress.usa.net>

Using Numeric very often I need function like map which return array as result
(not list).

Now I must to write something like:

def array_map(func, A):
    shape = A.shape
    return reshape( array(map(func, reshape(A, (-1,)))), shape )

or use <for>. But this is a slow way :-(
Note: func is not builtin or trivial (simple).

It will be very nice to modify function map or write clone (in C or C++),
for example <array_map>
     array_map( func, array1, array2, ..., arrayn ),
which 
- detect the shape S of arrays 
  (let suppose, that arrays have the same shape);
- create array of shape S for result;
- organize the internal loop to apply user function to elements
of input arrays and put the value in result array.

Supposed, that we have user function:
     def func( a1, a2, ..., an ):
         .................

Zaur




 

____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1


From Oliphant.Travis@mayo.edu  Mon Apr 19 16:01:03 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Mon, 19 Apr 1999 10:01:03 -0500 (CDT)
Subject: [Matrix-SIG] array_map?
Message-ID: <Pine.LNX.4.04.9904190951480.25450-100000@us2.mayo.edu>

Two comments:

Much of the time you can define your function to operate on general
arrays anyway so that when it takes an array it returns an array.  This
is due to the way the mathematical operators are mapped over arrays
(ufuncs).

At times you may not be able to write your function like that.  It looks
like you want a way to make a regular python function that takes numbers
as arguments into a "ufunc" so that it works nicely over arrays with the
casting and broadcasting rules applied as with all other ufuncs.  I've
thought some about this and think it is possible to make a class that
could be used to "wrap" up functions you want to use in this way.

From the source code it looks like there was going to be an array_map()
function at some point but I don't know what happened to it, or why it was
never developed.

Travis




From dubois1@llnl.gov  Mon Apr 19 18:53:07 1999
From: dubois1@llnl.gov (Paul F. Dubois)
Date: Mon, 19 Apr 1999 10:53:07 -0700
Subject: [Matrix-SIG] LLNL distribution 11 available
Message-ID: <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.com>

xfiles.llnl.gov and ftp-icf.llnl.gov are now back up, and I have fought my
way back through the security changes so I was able to fix the links to make
them point to version 11. Versions 9 and 10 are also available via the ftp
site.

At version 11 the Windows distribution changes from a .exe file (an
installer) to a .zip file that has a simple installation script you run with
Python. This installation procedure requires Python 1.5. If you do not have
Python 1.5 you will have to install by hand in whatever way you choose.

Those of you who tried to use the link to LLNLDistribution.zip and failed
were victims of the sudden LLNL shutdown, for which we are sorry.

I also discovered that I had failed to upload the gifs and style sheet for
the HTML version of the Numerical Python document. That is fixed too.
Another reason to prefer PDF.(:->.






From just@letterror.com  Tue Apr 20 11:46:30 1999
From: just@letterror.com (Just van Rossum)
Date: Tue, 20 Apr 1999 12:46:30 +0200
Subject: [Matrix-SIG] no round() in NumPy?
Message-ID: <l03102801b3420a8b5495@[193.78.237.138]>

Hi there,

I need to round an array of floats so I can safely convert them to
integers. I can't seem to find a round() function in NumPy, and since I
have to deal with negative numbers as well as positive I can't just add 0.5
and floor() 'em. Am I missing something obvious? What is the NumPy way of
doing this?

Thanks,

Just




From just@letterror.com  Tue Apr 20 11:57:21 1999
From: just@letterror.com (Just van Rossum)
Date: Tue, 20 Apr 1999 12:57:21 +0200
Subject: [Matrix-SIG] nevermind! (no round() in NumPy?)
Message-ID: <l03102802b3420d75045c@[193.78.237.138]>

Sorry, I must be having a bad day. I somehow remembered floor() going
towards zero, instead of going down *always*. So adding 0.5 and the
floor()-ing does work after all... Sorry for wasting your time. (Still, a
round() function woud be nice, no?)

Just




From jhauser@ifm.uni-kiel.de  Tue Apr 20 12:46:46 1999
From: jhauser@ifm.uni-kiel.de (jhauser@ifm.uni-kiel.de)
Date: Tue, 20 Apr 1999 13:46:46 +0200 (CEST)
Subject: [Matrix-SIG] nevermind! (no round() in NumPy?)
In-Reply-To: <l03102802b3420d75045c@[193.78.237.138]>
References: <l03102802b3420d75045c@[193.78.237.138]>
Message-ID: <14108.26251.594537.683223@lisboa>

I have this function here to round like python does. (Hopefully)

__Janko

## cut here ###
def around(m, signif=0):
    """
    Should round in the way Python builtin round does it. Presume
    that this is the right way to do it.
    """
    m = Numeric.asarray(m)
    s = sign(m)
    if signif:
        m = Numeric.absolute(m*10.**signif)
    else:
        m = Numeric.absolute(m)
    rem = m-Numeric.asarray(m).astype(Numeric.Int)
    m = Numeric.where(Numeric.less(rem,0.5), Numeric.floor(m), Numeric.ceil(m))
    # convert back
    if signif:
        m = m*s/(10.**signif)
    else:
        m = m*s
    return m
    
def sign(m):
    """
    Gives an array with shape of m. Where array less than 0 a=-1,
    where m greater null a=1, elsewhere a=0.
    """
    m = Numeric.asarray(m)

    if ((type(m) == type(1.4)) or (type(m) == type(1))):
	return m-m-Numeric.less(m,0)+Numeric.greater(m,0)
    else:
	return Numeric.zeros(Numeric.shape(m))-Numeric.less(m,0)+Numeric.greater(m,0)

Just van Rossum writes:
 > Sorry, I must be having a bad day. I somehow remembered floor() going
 > towards zero, instead of going down *always*. So adding 0.5 and the
 > floor()-ing does work after all... Sorry for wasting your time. (Still, a
 > round() function woud be nice, no?)
 > 
 > Just
 > 
 > 
 > 
 > _______________________________________________
 > Matrix-SIG maillist  -  Matrix-SIG@python.org
 > http://www.python.org/mailman/listinfo/matrix-sig
 > 


From tismer@appliedbiometrics.com  Tue Apr 20 13:41:45 1999
From: tismer@appliedbiometrics.com (Christian Tismer)
Date: Tue, 20 Apr 1999 14:41:45 +0200
Subject: [Matrix-SIG] numpy interface
References: <Pine.LNX.4.04.9904110221070.7997-100000@us2.mayo.edu> <386F1FA9.BD2B7119@cs.utexas.edu>
Message-ID: <371C7609.297BB742@appliedbiometrics.com>


pascucci wrote:
> 
> Hi,
> 
> I am new in this list.
> I would like to access NumericPython arrays in my own  C/C++ library.
> Does anyone have a piece of SWIG interface that can be used at this end?

I don't believe that you need SWIG to call NumPy from C, since
NumPy's C API can be used like Python's C API.
Do you just want to use NumPy's functions from C, or
are you going to use Python scripting as well?
The latter would mean to turn your C lib into something
which can be called from Python, and this might make use 
of SWIG, perhaps.
But if you are looking for maximum speed, I'd avoid generated
interfaces and craft my own. Calling overhead can be
significant, if you need many short calls with low computation
time.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home


From robin@jessikat.demon.co.uk  Tue Apr 20 18:42:10 1999
From: robin@jessikat.demon.co.uk (Robin Becker)
Date: Tue, 20 Apr 1999 18:42:10 +0100
Subject: [Matrix-SIG] LLNL distribution 11 available
In-Reply-To: <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.com>
References: <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.com>
Message-ID: <Amsh6CAyxLH3EwPj@jessikat.demon.co.uk>

In article <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.c
om>, Paul F. Dubois <dubois1@llnl.gov> writes
>xfiles.llnl.gov and ftp-icf.llnl.gov are now back up, and I have fought my
>way back through the security changes so I was able to fix the links to make
>them point to version 11. Versions 9 and 10 are also available via the ftp
>site.
>
>At version 11 the Windows distribution changes from a .exe file (an
>installer) to a .zip file that has a simple installation script you run with
>Python. This installation procedure requires Python 1.5. If you do not have
>Python 1.5 you will have to install by hand in whatever way you choose.
>
>Those of you who tried to use the link to LLNLDistribution.zip and failed
>were victims of the sudden LLNL shutdown, for which we are sorry.
>
>I also discovered that I had failed to upload the gifs and style sheet for
>the HTML version of the Numerical Python document. That is fixed too.
>Another reason to prefer PDF.(:->.
>
>
perhaps someone can help me with this win32 install win95 osr2, python
1.5.2 final.

1) do I need to uninstall rel10?
2) is the process
        a) unzip to a temporary dir
        b) run python tools/installtool.py
        c) if so I get the error

                C:\>cd \tmp\llnl\tools

                C:\Tmp\LLNL\Tools>python installtool.py
                Traceback (innermost last):
                File "installtool.py", line 130, in ?
                do_install()
                File "installtool.py", line 33, in do_install
                if MODE == None:
                NameError: MODE

                C:\Tmp\LLNL\Tools>

        
>
>
>
>_______________________________________________
>Matrix-SIG maillist  -  Matrix-SIG@python.org
>http://www.python.org/mailman/listinfo/matrix-sig
>

-- 
Robin Becker


From phil@geog.ubc.ca  Tue Apr 20 18:48:54 1999
From: phil@geog.ubc.ca (Phil Austin)
Date: Tue, 20 Apr 1999 10:48:54 -0700
Subject: [Matrix-SIG] numpy interface
In-Reply-To: <371C7609.297BB742@appliedbiometrics.com>
References: <Pine.LNX.4.04.9904110221070.7997-100000@us2.mayo.edu>
 <386F1FA9.BD2B7119@cs.utexas.edu>
 <371C7609.297BB742@appliedbiometrics.com>
Message-ID: <199904201748.KAA01024@brant.geog.ubc.ca>

Christian Tismer writes:
 > 
 > 
 > I don't believe that you need SWIG to call NumPy from C, since
 > NumPy's C API can be used like Python's C API.

Right -- and you might also want to have a look at Paul Dubois'
CXX_Array.h (http://xfiles.llnl.gov/CXX_Objects/cxx.htm), which
provides a very clean C++ interface to PyArrays (albeit with 1-d
subscripting only), dicts, tupples, etc.  

From the C++ side, your code would look something
like this:

Py::Array count(pyob);   //construct a 1-d array Pn with pyob's data
Py::Dict output;  //construct a C++ version of a Python dictionary
output["count"]=count; //put the count array in the output dictionary
return Py::new_reference_to(output);  //send the dictionary with the 
                                      // count array back to Python

To get around the 1-d subscripting limitation I use a class I
call TiedArray, which creates a Py::Array and a Blitz++ array
(http://monet.uwaterloo.ca/blitz)
that share the same data.  I can then use Blitz notation on the
C++ side, while easily shipping the data back to Python.  

Here's an example I posted about 4 months ago which calculates
something called the 2 dimensional isotropic 
2nd order structure function for a
satellite image.  I've modified the Py::Array constructor
to support Blitz TinyVectors -- I'm happy to send you this
two-line modification if you're a Blitz user.


#include "Python.h"
#include "CXX_Objects.h"
#include "CXX_Extensions.h"
#include <blitz/array.h>
#include "CXX_Array.h"
#include <math.h>



template<typename T,int Ndim> class TiedArray;


template<> class TiedArray<float,2> 
//take an existing PyObject or a N-length TinyVector and
//construct an N-dimensional array shared by Python and Blitz.
//Note that the Python array controls the memory deallocation;
//the Blitz array just holds a reference to the Pn's data
{
public:
  Py::Array Pn;
  blitz::Array<float,2> Bz;
  TiedArray(blitz::TinyVector<int,2> dimens):Pn(dimens,PyArray_FLOAT) //added to CXX_Array by PA: 98/12/30
    {
      blitz::Array<float,2> tempArray((float*) Pn.to_C(),dimens);
      Bz.reference(tempArray);
    };  
  TiedArray(Py::seqref<Py::Object> pyob):Pn(pyob)
    {
      assert(Pn.rank()==2);
      assert(Pn.species()==PyArray_FLOAT);
      blitz::Array<float,2> tempArray((float*) Pn.to_C(),blitz::shape(Pn.dimension(1),
	      Pn.dimension(2)));
      Bz.reference(tempArray);
    };
};


static PyObject *
ex_strucout(PyObject* self, PyObject* args)
//
// calculate the 2nd order structure function given
// a 2-d NumPy array of floats
//
{
  Py_Initialize();
  import_array();
  PyImport_ImportModule("Numeric");

  Py::Tuple t(args);
  TiedArray<float,2> tau(t[0]);
  assert(tau.Pn.dimension(1)==tau.Pn.dimension(2));
  int N=tau.Pn.dimension(1);
  int Nbig=2*N-1;
  blitz::TinyVector<int,2> tinyDimens(Nbig,Nbig);
  TiedArray<float,2> sf(tinyDimens);
  TiedArray<float,2> count(tinyDimens);

  sf.Bz=0.;
  count.Bz=0.;

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(!isnan(tau.Bz(i,j)))
	{
	  for(int k=0;k<N;k++){
	    for(int l=0;l<N;l++){
	      if(!isnan(tau.Bz(k,l)))
		{
		  sf.Bz(k-i+N,l-j+N)=sf.Bz(k-i+N,l-j+N) + pow((tau.Bz(k,l) - tau.Bz(i,j)),2);
		  count.Bz(k-i+N,l-j+N)=count.Bz(k-i+N,l-j+N) + 1.;
		}
	    }
	  }
	}
    }
  }
  for (int i=0; i<Nbig; i++) {
    for (int j=0; j<Nbig; j++) {
      if(count.Bz(i,j) > 0.){
	sf.Bz(i,j)=sf.Bz(i,j)/count.Bz(i,j);
      }
    }
  }
  Py::Dict output;
  output["count"]=count.Pn;
  output["struct"]=sf.Pn;
  return Py::new_reference_to(output);
}


extern "C" void initstrucfun();

static Py::ExtensionModule* strucfun;

void initstrucfun()
{
    // experimental initialization stuff
    strucfun = new Py::ExtensionModule("strucfun");
    strucfun->add("strucout", ex_strucout, "calculate the structure function");
    Py::Dict d = strucfun->initialize();
}

___________compile above into strucfun.so and use this from python

from Numeric import *
import strucfun

test=arange(4,typecode=Float32)
test.shape=(2,2)
print strucfun.strucout(test)


From dubois1@llnl.gov  Tue Apr 20 19:54:56 1999
From: dubois1@llnl.gov (Paul F. Dubois)
Date: Tue, 20 Apr 1999 11:54:56 -0700
Subject: [Matrix-SIG] LLNL distribution 11 available
References: <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.com> <Amsh6CAyxLH3EwPj@jessikat.demon.co.uk>
Message-ID: <005001be8b5f$4b61b0c0$f4160218@plstn1.sfba.home.com>

The installation procedure is described in INSTALL.html. However, the short
version is, for Windows,
double-click on install_windows.bat.

Your guess about what to do was intelligent but incorrect.
----- Original Message -----
From: Robin Becker <robin@jessikat.demon.co.uk>
To: <matrix-sig@python.org>
Sent: Tuesday, April 20, 1999 10:42 AM
Subject: Re: [Matrix-SIG] LLNL distribution 11 available


> In article <001101be8a8d$7b9c1140$f4160218@c1004579-c.plstn1.sfba.home.c
> om>, Paul F. Dubois <dubois1@llnl.gov> writes
> >xfiles.llnl.gov and ftp-icf.llnl.gov are now back up, and I have fought
my
> >way back through the security changes so I was able to fix the links to
make
> >them point to version 11. Versions 9 and 10 are also available via the
ftp
> >site.
> >
> >At version 11 the Windows distribution changes from a .exe file (an
> >installer) to a .zip file that has a simple installation script you run
with
> >Python. This installation procedure requires Python 1.5. If you do not
have
> >Python 1.5 you will have to install by hand in whatever way you choose.
> >
> >Those of you who tried to use the link to LLNLDistribution.zip and failed
> >were victims of the sudden LLNL shutdown, for which we are sorry.
> >
> >I also discovered that I had failed to upload the gifs and style sheet
for
> >the HTML version of the Numerical Python document. That is fixed too.
> >Another reason to prefer PDF.(:->.
> >
> >
> perhaps someone can help me with this win32 install win95 osr2, python
> 1.5.2 final.
>
> 1) do I need to uninstall rel10?
> 2) is the process
>         a) unzip to a temporary dir
>         b) run python tools/installtool.py
>         c) if so I get the error
>
>                 C:\>cd \tmp\llnl\tools
>
>                 C:\Tmp\LLNL\Tools>python installtool.py
>                 Traceback (innermost last):
>                 File "installtool.py", line 130, in ?
>                 do_install()
>                 File "installtool.py", line 33, in do_install
>                 if MODE == None:
>                 NameError: MODE
>
>                 C:\Tmp\LLNL\Tools>
>
>
> >
> >
> >
> >_______________________________________________
> >Matrix-SIG maillist  -  Matrix-SIG@python.org
> >http://www.python.org/mailman/listinfo/matrix-sig
> >
>
> --
> Robin Becker
>
> _______________________________________________
> Matrix-SIG maillist  -  Matrix-SIG@python.org
> http://www.python.org/mailman/listinfo/matrix-sig
>
>



From edcjones@erols.com  Tue Apr 20 12:27:38 1999
From: edcjones@erols.com (Edward C. Jones)
Date: Tue, 20 Apr 1999 07:27:38 -0400
Subject: [Matrix-SIG] Sorting arrays lexicographically by row
Message-ID: <371C64A9.9B7F7C1C@erols.com>

Here is a small piece of Python code:

arr = [[3,1], [3,0], [2,1], [1,0], [2,2]]
arr.sort()
print arr

The output is:

[[1, 0], [2, 1], [2, 2], [3, 0], [3, 1]]

Can I do this (lexicographic) type of sorting using NumPy on a
NumPy array?

Thanks,
  Ed Jones




From roitblat@hawaii.edu  Fri Apr 23 05:03:24 1999
From: roitblat@hawaii.edu (Herbert L. Roitblat)
Date: Thu, 22 Apr 1999 18:03:24 -1000
Subject: [Matrix-SIG] Reading and handling matrices
Message-ID: <001101be8d3e$3c899190$bef07fce@0gl1u.pixi.com>

This is a multi-part message in MIME format.

------=_NextPart_000_000E_01BE8CEA.6ADD8190
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi folks,=20
I'm just starting with python and I'm having a few problems, which I =
suspect are rather simple-minded.

1. I was looking for some sparse matrix functions that would let me =
compute the eigen vectors of a rather large matrix in a reasonable =
amount of time.  I have found the eigen value functions in the numeric =
library and I have found some linear algebra routines that allow sparse =
matrices, but I do not see a way to combine these.  I ended up saving =
the matrix as ascii, editing it using word, reading it using excel, and =
then importing it to matlab.  There has to be a better way.

2. After having processed it in matlab, I am having trouble figuring out =
how to get the result back into python.  Does anyone have a routine to =
read matlab *.mat files?  Array has a fromfile method, but I cannot seem =
to make it work.  Once I resize the array (using reshape), the fromfile =
method disappears from the object.  I succeeded in getting something =
read into an array but it was gibberish.  I was reading an ascii file. =20

I have read a couple of the posted tutorials on using matrices, but =
basically I am confused.  I would greatly appreciate a couple of =
pointers to get my head straight.  Thanks for your time.


Herb
Herbert L. Roitblat, Ph.D.
Department of Psychology
University of Hawaii

------=_NextPart_000_000E_01BE8CEA.6ADD8190
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Hi folks, </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>I'm just starting with python and =
I'm having a=20
few problems, which I suspect are rather simple-minded.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>1. I was looking for some sparse matrix functions =
that would=20
let me compute the eigen vectors of a rather large matrix in a =
reasonable amount=20
of time.&nbsp; I have found the eigen value functions in the numeric =
library and=20
I have found some linear algebra routines that allow sparse matrices, =
but I do=20
not see a way to combine these.&nbsp; I ended up saving the matrix as =
ascii,=20
editing it using word, reading it using excel, and then importing it to=20
matlab.&nbsp; There has to be a better way.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>2. After having processed it in matlab, I am having =
trouble=20
figuring out how to get the result back into python.&nbsp; Does anyone =
have a=20
routine to read matlab *.mat files?&nbsp; Array has a fromfile method, =
but I=20
cannot seem to make it work.&nbsp; Once I resize the array (using =
reshape), the=20
fromfile method disappears from the object.&nbsp; I succeeded in getting =

something read into an array but it was gibberish.&nbsp; I was reading =
an ascii=20
file.&nbsp; </FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I have read a couple of the posted tutorials on =
using=20
matrices, but basically I am confused.&nbsp; I would greatly appreciate =
a couple=20
of pointers to get my head straight.&nbsp; Thanks for your =
time.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Herb</FONT></DIV>
<DIV><FONT size=3D2>Herbert L. Roitblat, Ph.D.</FONT></DIV>
<DIV><FONT size=3D2>Department of Psychology</FONT></DIV>
<DIV><FONT size=3D2>University of Hawaii</FONT></DIV></BODY></HTML>

------=_NextPart_000_000E_01BE8CEA.6ADD8190--



From jhauser@ifm.uni-kiel.de  Fri Apr 23 10:11:21 1999
From: jhauser@ifm.uni-kiel.de (jhauser@ifm.uni-kiel.de)
Date: Fri, 23 Apr 1999 11:11:21 +0200 (CEST)
Subject: [Matrix-SIG] Sorting arrays lexicographically by row
In-Reply-To: <371C64A9.9B7F7C1C@erols.com>
References: <371C64A9.9B7F7C1C@erols.com>
Message-ID: <14112.14251.599737.610662@lisboa>

There is argsort, with which one can try to build a custom
sort-function.

But the most easy and probably also efficient method is to use pythons 
list sort.

The conversion from an array to a list of lists cost nearly no
time. The sorting on lists is definetly very good optimized.
So use:
>>> a
array([[3, 1],
       [3, 0],
       [2, 1],
       [1, 0],
       [2, 2]])
>>> b=a.tolist()
>>> b.sort()
>>> array(b)
array([[1, 0],
       [2, 1],
       [2, 2],
       [3, 0],
       [3, 1]])

The steps in between are needed, because the methods do not return
arrays. 

HTH,
__Janko

Edward C. Jones writes:
 > Here is a small piece of Python code:
 > 
 > arr = [[3,1], [3,0], [2,1], [1,0], [2,2]]
 > arr.sort()
 > print arr
 > 
 > The output is:
 > 
 > [[1, 0], [2, 1], [2, 2], [3, 0], [3, 1]]
 > 
 > Can I do this (lexicographic) type of sorting using NumPy on a
 > NumPy array?
 > 
 > Thanks,
 >   Ed Jones
 > 
 > 
 > 
 > _______________________________________________
 > Matrix-SIG maillist  -  Matrix-SIG@python.org
 > http://www.python.org/mailman/listinfo/matrix-sig
 > 


From mxu1@broadway.GC.cuny.edu  Fri Apr 23 15:09:17 1999
From: mxu1@broadway.GC.cuny.edu (mxu1@broadway.GC.cuny.edu)
Date: Fri, 23 Apr 1999 10:09:17 -0400
Subject: [Matrix-SIG] Reading and handling matrices
In-Reply-To: roitblat's message of Thu, 22 Apr 1999 18:03:24 -1000.
 <001101be8d3e$3c899190$bef07fce@0gl1u.pixi.com>
Message-ID: <199904231409.KAA00761@star.future.com>

Hi, 

I have some codes for reading matlab4 binary files to and from python and it 
only handles 2d full matrices. This is a part of my interface to Octave, a 
matlab clone.

I will clean it up and post the code.


But other way is to use pymat, you can find it in the web page.







-- 
Min Xu				
City College of NY, CUNY		
Email:	mxu1@email.gc.cuny.edu
       	minxu@sci.ccny.cuny.edu	 
Tel:	(O) (212) 650-6865
	(O) (212) 650-5046
	(H) (212) 690-2119		



-- 
Min Xu				
City College of NY, CUNY		
Email:	mxu1@email.gc.cuny.edu
       	minxu@sci.ccny.cuny.edu	 
Tel:	(O) (212) 650-6865
	(O) (212) 650-5046
	(H) (212) 690-2119		




From hinsen@cnrs-orleans.fr  Fri Apr 23 16:28:57 1999
From: hinsen@cnrs-orleans.fr (Konrad Hinsen)
Date: Fri, 23 Apr 1999 17:28:57 +0200
Subject: [Matrix-SIG] Reading and handling matrices
In-Reply-To: <001101be8d3e$3c899190$bef07fce@0gl1u.pixi.com>
 (roitblat@hawaii.edu)
References: <001101be8d3e$3c899190$bef07fce@0gl1u.pixi.com>
Message-ID: <199904231528.RAA22325@chinon.cnrs-orleans.fr>

> 1. I was looking for some sparse matrix functions that would let me
>  compute the eigen vectors of a rather large matrix in a
>  reasonable amount of time. I have found the eigen value functions
>  in the numeric library and I have found some linear algebra
>  routines that allow sparse matrices, but I do not see a way to
>  combine these. I ended up saving the matrix as ascii, editing it

Does that mean that your matrices are sparse? In that case, you should
use appropriate techniques, but... the problem with sparse matrices is
that there are so many different kinds of them, each requiring special
handling. Sparse matrix libraries usually require the user to provide
a matrix-vector multiplication routine. This routine has to use the
calling conventions of the library and is thus very likely impossible
to write in Python, even if performance were not a problem.

What this means is that I don't expect to find general sparse matrix
support in a Python package any time soon. Important special cases
could of course be handled.

If by any chance your matrices have the structure of second-derivative
matrices of finite-range potentials, I could provide a corresponding
sparse-matrix implementation with interfaces to ARPACK for finding
eigenvalues. In fact, it's in my Molecular Modelling Toolkit
(http://starship.python.net/crew/hinsen/mmtk.html)
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------


From Oliphant.Travis@mayo.edu  Fri Apr 23 19:24:31 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Fri, 23 Apr 1999 13:24:31 -0500 (CDT)
Subject: [Matrix-SIG] Reading and handling matrices.
Message-ID: <Pine.LNX.4.04.9904231300020.25599-100000@us2.mayo.edu>

> I'm just starting with python and I'm having a few problems, which I =
> suspect are rather simple-minded.

Welcome aboard, starting with a new system can be intimidating.

> 1. I was looking for some sparse matrix functions that would let me =
> compute the eigen vectors of a rather large matrix in a reasonable =
> amount of time.  I have found the eigen value functions in the numeric =
> library and I have found some linear algebra routines that allow sparse
> matrices, but I do not see a way to combine these.  I ended up saving =
> the matrix as ascii, editing it using word, reading it using excel, and
> then importing it to matlab.  There has to be a better way.

Sparse matrices:

As Konrad said there are several ways to handle sparse matrices, but
no "comprehensive" package. There is a sparse matrix module that I can't
say anything about except that it exists.  It defines a sparse matrix
object and some methods for linear equation solving.  Look on
http://www.python.org/topics/scicomp/numbercrunching.html
for the Sparse Linear Equation Solver module by Neil Schemenauer

Adding good sparse matrix support is something I'll be trying to add to my
collection of useful packages for NumPy over the next year or two.  When I
get to that point I'll likely start with the module on that page.

It sounds like you went through a lot of work getting data in and out of
NumPy arrays.  This was a source of confusion for me at first, too, so I
understand a bit of the frustration.  The frustration does disappear
as you get a feel for the structure of Python and the Numeric extensions.

I wanted to read arbitrary binary files and so wrote a C-extension module
that reads arbitrary binary data into Python NumPy arrays.  It turns out,
I could have accomplished what I wanted to do with the fromstring function
from the Numeric module and the read method of any file object.

One method to get your data into MATLAB is to open a file object in
Python and write the data in your NumPy array as a "string" (i.e. a
sequence of raw bytes).

>>> import Numeric
>>> a = Numeric.ones((512,512))  # an uninteresting array of integers
>>> fid = open("myfile","w")
>>> fid.write(a.tostring())
>>> fid.close()

If you are on a 32-bit machine, you will now have a file called "myfile"
in the current directory that should contain (512*512*4) bytes of 4-byte
integer ones.

You can read this data into MATLAB using matlab's fread function:

>> fid = fopen('myfile');
>> a = fread(fid,512*512,'int');
>> fclose(fid);

The same sequence works in reverse use MATLAB's fwrite function and
Numeric Python's fromstring function and the read method of an open file
object.

You should NEVER have to edit numbers by hand in Word.  It makes me sad
that you felt the need to do that.  This is a pretty low level way to read
and write data, but is indispensable when interfacing with other code and
outputs from other code.  A better solution is to use a higher level file
format like NETCDF which you can read and write to from MATLAB and NumPy.

Of course, I would wonder why you were doing much work in MATLAB anyway
:-) (and if you are then what is NumPy missing and we'll add it.)

If you want it I could send you a module I rarely use now that makes the
NumPy way of reading and writing binary data more like MATLAB's which I
was used, too when I started.

Best of luck on your newfound tool.  Feel free to ask anymore questions as
they arise.

Sincerely,

Travis Oliphant.

(just a run-o'-the-mill NumPy fan)



From roitblat@hawaii.edu  Fri Apr 23 19:54:39 1999
From: roitblat@hawaii.edu (Herbert L. Roitblat)
Date: Fri, 23 Apr 1999 08:54:39 -1000
Subject: [Matrix-SIG] Re: Reading and handling matrices.
Message-ID: <004601be8dba$bda7d940$bef07fce@0gl1u.pixi.com>

Thanks very much for your really helpful response.  Let me digest that
before I bother anyone further.  Between you and Konrad I feel that I am on
my way.

The reason I used matlab at all was because it had the sparse matrix
functions I was looking for.  I have a sparse matrix consisting of integers
spread over a large matrix.  First I am practicing with a fairly "small"
matrix of only 2700 x 2700 element (about 350,000 of which are nonzero), but
I expect that the program will be used with matrices up to 50k x 50k, hence
the need for sparsity.  I need to get the eigen vectors for that matrix.

I am on the edge of my knowledge when dealing with many of these problems
(both in terms of the linerar algebra and in terms of python), so I really
appreciate your help.

Thanks a lot.
Herb

-----Original Message-----
From: Travis Oliphant <Oliphant.Travis@mayo.edu>
To: roitblat@hawaii.edu <roitblat@hawaii.edu>
Cc: matrix-sig@python.org <matrix-sig@python.org>
Date: Friday, April 23, 1999 8:25 AM
Subject: Reading and handling matrices.


>
>> I'm just starting with python and I'm having a few problems, which I =
>> suspect are rather simple-minded.
>
>Welcome aboard, starting with a new system can be intimidating.
>
>> 1. I was looking for some sparse matrix functions that would let me =
>> compute the eigen vectors of a rather large matrix in a reasonable =
>> amount of time.  I have found the eigen value functions in the numeric =
>> library and I have found some linear algebra routines that allow sparse
>> matrices, but I do not see a way to combine these.  I ended up saving =
>> the matrix as ascii, editing it using word, reading it using excel, and
>> then importing it to matlab.  There has to be a better way.
>
>Sparse matrices:
>
>As Konrad said there are several ways to handle sparse matrices, but
>no "comprehensive" package. There is a sparse matrix module that I can't
>say anything about except that it exists.  It defines a sparse matrix
>object and some methods for linear equation solving.  Look on
>http://www.python.org/topics/scicomp/numbercrunching.html
>for the Sparse Linear Equation Solver module by Neil Schemenauer
>
>Adding good sparse matrix support is something I'll be trying to add to my
>collection of useful packages for NumPy over the next year or two.  When I
>get to that point I'll likely start with the module on that page.
>
>It sounds like you went through a lot of work getting data in and out of
>NumPy arrays.  This was a source of confusion for me at first, too, so I
>understand a bit of the frustration.  The frustration does disappear
>as you get a feel for the structure of Python and the Numeric extensions.
>
>I wanted to read arbitrary binary files and so wrote a C-extension module
>that reads arbitrary binary data into Python NumPy arrays.  It turns out,
>I could have accomplished what I wanted to do with the fromstring function
>from the Numeric module and the read method of any file object.
>
>One method to get your data into MATLAB is to open a file object in
>Python and write the data in your NumPy array as a "string" (i.e. a
>sequence of raw bytes).
>
>>>> import Numeric
>>>> a = Numeric.ones((512,512))  # an uninteresting array of integers
>>>> fid = open("myfile","w")
>>>> fid.write(a.tostring())
>>>> fid.close()
>
>If you are on a 32-bit machine, you will now have a file called "myfile"
>in the current directory that should contain (512*512*4) bytes of 4-byte
>integer ones.
>
>You can read this data into MATLAB using matlab's fread function:
>
>>> fid = fopen('myfile');
>>> a = fread(fid,512*512,'int');
>>> fclose(fid);
>
>The same sequence works in reverse use MATLAB's fwrite function and
>Numeric Python's fromstring function and the read method of an open file
>object.
>
>You should NEVER have to edit numbers by hand in Word.  It makes me sad
>that you felt the need to do that.  This is a pretty low level way to read
>and write data, but is indispensable when interfacing with other code and
>outputs from other code.  A better solution is to use a higher level file
>format like NETCDF which you can read and write to from MATLAB and NumPy.
>
>Of course, I would wonder why you were doing much work in MATLAB anyway
>:-) (and if you are then what is NumPy missing and we'll add it.)
>
>If you want it I could send you a module I rarely use now that makes the
>NumPy way of reading and writing binary data more like MATLAB's which I
>was used, too when I started.
>
>Best of luck on your newfound tool.  Feel free to ask anymore questions as
>they arise.
>
>Sincerely,
>
>Travis Oliphant.
>
>(just a run-o'-the-mill NumPy fan)
>
>



From jhauser@ifm.uni-kiel.de  Fri Apr 23 23:16:44 1999
From: jhauser@ifm.uni-kiel.de (jhauser@ifm.uni-kiel.de)
Date: Sat, 24 Apr 1999 00:16:44 +0200 (CEST)
Subject: [Matrix-SIG] Re: Reading and handling matrices.
In-Reply-To: <004601be8dba$bda7d940$bef07fce@0gl1u.pixi.com>
References: <004601be8dba$bda7d940$bef07fce@0gl1u.pixi.com>
Message-ID: <14112.61498.83835.276616@lisboa>

Hi to make you a little bit more comfortable in the transition from
Matlab to NumPy I append a first test version of a binary matlab file
IO class. It can only read Matlab Ver. 4 files but these can easily be 
written by all recent Versions.

Please test it, especially if you use some special types in the *.mat
files. If there are errors or questions please feel free to mail me.

HTH

__Janko

#!/usr/bin/env python
#
# mat.py
# Fast module to read matlab files (vers <= 4.2)
# Needs numpyio now part of signaltools from Travis Oliphant. Get it at
# http://oliphant.netpedia.net/ 
#
__ver__ = '0.1.1'
__author__ = 'jhauser@ifm.uni-kiel.de'

import os, struct
import string
import numpyio
import Numeric

MatIOError = 'MatIOError'

class MatFile:
    """File object representing a matlab file which is written so matlab 4 can
    read it. ( -v4 in Matlab 5). The object maps the variables in the file to
    attributes, which are loaded when one needs them. With the vars method all
    the names can be seen, without loading the data.
    """
    def __init__(self, fname, mode='r', endian='<'):
        try:
            self.fp = open(fname, mode)
            self.mode = mode
        except:
            raise IOError, "Cant't open "+fname
        
        self.fname = fname
        self.vardir = {}
        self.mtype={0:'d', 1:'d', 10:'f', 20:'l', 30:'h', 40:'H', 50:'B',
                    'd':1, 'f':10, 'l':20, 'h':30, 'H':40, 'B':50}
        self.endian = endian # default is little endian
        self.swap = 0
        self._getheaders()

    def __getattr__(self, attr):
        if attr in self.__dict__['vardir'].keys():
            self.__dict__[attr] = self._getvar(attr)
        return self.__dict__[attr]

    def write(self, name, attr):
        """Write data to file"""
        if name in self.vars():
            raise MatIOError, " there is a variable named %s in file %s" % \
                  (name, self.fname)
        
        self.fp.seek(0,2) # Use the whence parameter to go to end of file
        dend=self.fp.tell()
        header = self._mkheader(name, attr)
        header[5] = header[5]+dend+header[4] # set startbyte
        head_str = struct.pack(self.endian+'5l',header[0], header[1],
                                  header[2],header[3], header[4])
        self.fp.write(head_str)
        self.fp.write(struct.pack(self.endian+`header[4]`+'s', name))
        
        numpyio.fwrite(self.fp, 
                       header[1]*header[2], 
                       attr,
                       attr.typecode(),
                       self.swap)
        self.vardir[name] = header
        self.fp.flush()
        return
        
    def _mkheader(self, name, m):
        """Build a header structure for a matlab file. Thats the items in
        self.vardir.
        
        Format:
        0  0 (Le) or 1000 (Be) for endianes
        1  10 M of size MxN matrix (columns)
        2  10 N of size MxN matrix (rows)
        3  0  typecode of data
        4  2  length of name + 1
        5  22 start of data in bytes
        6  78 length of data in bytes
        """
        m=Numeric.asarray(m)
        if len(m.shape) > 2:
            raise MatIOError
        header=[0]
        header.append(m.shape[0])
        header.append(m.shape[1])
        header.append(self.mtype[m.typecode()]) # Not all are mapped!
        header.append(len(name)+1)
        header.append(0) # start later with an offeset. No seek here
        header.append(struct.calcsize(
                      `header[1]*header[2]`+m.typecode()))
        return header
        

    def _getheaders(self):
        """Iterate over the file and get each header with start position
        of data field. A header consists of 5 integers:
        0  0 (Le) or 1000 (Be) for endianes
        1  10 M of size MxN matrix (columns)
        2  10 N of size MxN matrix (rows)
        3  0  typecode of data
        4  2  length of name + 1

        Then follows the namestring of the variable, then the data
        """
        current = self.fp.tell()
        self.fp.seek(0)
        mlen = os.stat(self.fname)[6] # If the file is empty stop in while loop!
        # Check for endianess of data-file
        if mlen: # not a new file
            test = self.fp.read(4)
            if struct.unpack('<1l', test)[0] == 0:
                self.endian = '<'
                self.swap = 0
            elif struct.unpack('>1l', test)[0] == 1000:
                self.endian = '>'
                self.swap = 1
            else:
                raise MatIOError
            self.fp.seek(0)
            
        dend = 0
        mlen = os.stat(self.fname)[6] # If the file is empty stop here!
        while dend != mlen:
            start = dend
            header = list(struct.unpack(self.endian+'5l',self.fp.read(20)))
            tstart = start+20
            tend = tstart + header[4]
            dstart = tend
            dend = dstart+struct.calcsize(
                `header[1]*header[2]`+self.mtype[header[3]])
            name = struct.unpack(self.endian+`header[4]`+'s',
                                 self.fp.read(header[4]))
            name = name[0][:-1]
            map(header.append, (dstart, dend-dstart))

            self.vardir[name] = header
            self.fp.seek(dend)

        self.fp.seek(current)
        return

    def close(self):
        self.fp.close()
        return

    def _getvar(self, name):
        """Load the data from the file. Takes the info from the vardir_dictionary"""
        header = self.vardir[name]
        self.fp.seek(header[5])
        ar_size = header[1]*header[2]
        # read the data
        data = numpyio.fread(self.fp, 
                             ar_size, 
                             self.mtype[header[3]],
                             self.mtype[header[3]],
                             self.swap)
        if header[3] == 1: # That's a string in matlab represented by doubles
            return string.join(map(chr, data.tolist()),'')
        else:
            return Numeric.reshape(data, (header[1], header[2]))

    def vars(self):
        return self.vardir.keys()

# End of mat.py    


Herbert L. Roitblat writes:
 > Thanks very much for your really helpful response.  Let me digest that
 > before I bother anyone further.  Between you and Konrad I feel that I am on
 > my way.
 > 
 > The reason I used matlab at all was because it had the sparse matrix
 > functions I was looking for.  I have a sparse matrix consisting of integers
 > spread over a large matrix.  First I am practicing with a fairly "small"
 > matrix of only 2700 x 2700 element (about 350,000 of which are nonzero), but
 > I expect that the program will be used with matrices up to 50k x 50k, hence
 > the need for sparsity.  I need to get the eigen vectors for that matrix.
 > 
 > I am on the edge of my knowledge when dealing with many of these problems
 > (both in terms of the linerar algebra and in terms of python), so I really
 > appreciate your help.
 > 
 > Thanks a lot.
 > Herb
 > 
 > -----Original Message-----
 > From: Travis Oliphant <Oliphant.Travis@mayo.edu>
 > To: roitblat@hawaii.edu <roitblat@hawaii.edu>
 > Cc: matrix-sig@python.org <matrix-sig@python.org>
 > Date: Friday, April 23, 1999 8:25 AM
 > Subject: Reading and handling matrices.
 > 
 > 
 > >
 > >> I'm just starting with python and I'm having a few problems, which I =
 > >> suspect are rather simple-minded.
 > >
 > >Welcome aboard, starting with a new system can be intimidating.
 > >
 > >> 1. I was looking for some sparse matrix functions that would let me =
 > >> compute the eigen vectors of a rather large matrix in a reasonable =
 > >> amount of time.  I have found the eigen value functions in the numeric =
 > >> library and I have found some linear algebra routines that allow sparse
 > >> matrices, but I do not see a way to combine these.  I ended up saving =
 > >> the matrix as ascii, editing it using word, reading it using excel, and
 > >> then importing it to matlab.  There has to be a better way.
 > >
 > >Sparse matrices:
 > >
 > >As Konrad said there are several ways to handle sparse matrices, but
 > >no "comprehensive" package. There is a sparse matrix module that I can't
 > >say anything about except that it exists.  It defines a sparse matrix
 > >object and some methods for linear equation solving.  Look on
 > >http://www.python.org/topics/scicomp/numbercrunching.html
 > >for the Sparse Linear Equation Solver module by Neil Schemenauer
 > >
 > >Adding good sparse matrix support is something I'll be trying to add to my
 > >collection of useful packages for NumPy over the next year or two.  When I
 > >get to that point I'll likely start with the module on that page.
 > >
 > >It sounds like you went through a lot of work getting data in and out of
 > >NumPy arrays.  This was a source of confusion for me at first, too, so I
 > >understand a bit of the frustration.  The frustration does disappear
 > >as you get a feel for the structure of Python and the Numeric extensions.
 > >
 > >I wanted to read arbitrary binary files and so wrote a C-extension module
 > >that reads arbitrary binary data into Python NumPy arrays.  It turns out,
 > >I could have accomplished what I wanted to do with the fromstring function
 > >from the Numeric module and the read method of any file object.
 > >
 > >One method to get your data into MATLAB is to open a file object in
 > >Python and write the data in your NumPy array as a "string" (i.e. a
 > >sequence of raw bytes).
 > >
 > >>>> import Numeric
 > >>>> a = Numeric.ones((512,512))  # an uninteresting array of integers
 > >>>> fid = open("myfile","w")
 > >>>> fid.write(a.tostring())
 > >>>> fid.close()
 > >
 > >If you are on a 32-bit machine, you will now have a file called "myfile"
 > >in the current directory that should contain (512*512*4) bytes of 4-byte
 > >integer ones.
 > >
 > >You can read this data into MATLAB using matlab's fread function:
 > >
 > >>> fid = fopen('myfile');
 > >>> a = fread(fid,512*512,'int');
 > >>> fclose(fid);
 > >
 > >The same sequence works in reverse use MATLAB's fwrite function and
 > >Numeric Python's fromstring function and the read method of an open file
 > >object.
 > >
 > >You should NEVER have to edit numbers by hand in Word.  It makes me sad
 > >that you felt the need to do that.  This is a pretty low level way to read
 > >and write data, but is indispensable when interfacing with other code and
 > >outputs from other code.  A better solution is to use a higher level file
 > >format like NETCDF which you can read and write to from MATLAB and NumPy.
 > >
 > >Of course, I would wonder why you were doing much work in MATLAB anyway
 > >:-) (and if you are then what is NumPy missing and we'll add it.)
 > >
 > >If you want it I could send you a module I rarely use now that makes the
 > >NumPy way of reading and writing binary data more like MATLAB's which I
 > >was used, too when I started.
 > >
 > >Best of luck on your newfound tool.  Feel free to ask anymore questions as
 > >they arise.
 > >
 > >Sincerely,
 > >
 > >Travis Oliphant.
 > >
 > >(just a run-o'-the-mill NumPy fan)
 > >
 > >
 > 
 > 
 > _______________________________________________
 > Matrix-SIG maillist  -  Matrix-SIG@python.org
 > http://www.python.org/mailman/listinfo/matrix-sig
 > 


From Christos Siopis <siopis@astro.ufl.edu>  Sat Apr 24 02:03:47 1999
From: Christos Siopis <siopis@astro.ufl.edu> (Christos Siopis)
Date: Fri, 23 Apr 1999 21:03:47 -0400 (EDT)
Subject: [Matrix-SIG] Reading and handling matrices.
In-Reply-To: <Pine.LNX.4.04.9904231300020.25599-100000@us2.mayo.edu>
Message-ID: <Pine.LNX.3.96.990423203128.11244A-100000@saturn.astro.ufl.edu>

On Fri, 23 Apr 1999, Travis Oliphant wrote:

> I wanted to read arbitrary binary files and so wrote a C-extension module
> that reads arbitrary binary data into Python NumPy arrays.  It turns out,
> I could have accomplished what I wanted to do with the fromstring function
> from the Numeric module and the read method of any file object.

Dear Travis,

Allow me to disagree and point out the usefulness of your numpyio ;-)
I think what you are saying above is true if one does not have to deal
with large (compared to available RAM) data sets. In a recent project, I
had to work with two arrays of 75-100 Mb each. They had to be in memory
simultaneously. Using IDL, I could do that on a 196 Mb machine with
minimal swapping and even on a 128 Mb machine it was bearable. With Python
I had to resort to a 256 Mb machine (since, at one point, it has to hold
the first array, the second array as an array, and also the second array
as a string while conversion takes place). 

IMHO, binary I/O is a frequent task in data analysis and it would make
sense to add a tofile() and a fromfile() method for NumPy arrays, even in
the absence of any efficiency considerations... 

Christos



From just@letterror.com  Sat Apr 24 11:14:11 1999
From: just@letterror.com (Just van Rossum)
Date: Sat, 24 Apr 1999 12:14:11 +0200
Subject: [Matrix-SIG] minor NumPy + (Mac)Freeze problem & weird crash
Message-ID: <l03102800b34740317b74@[193.78.237.171]>

Folks,

On the Mac, I compile the NumPy C extensions as separate DLLs (I think this
is standard procedure, right?). It turns out I get a weird crash (when
importing Numeric) in _PyImport_LoadDynamicModule() if the _numpy DLL is
not available. Now, this could be caused by the Mac-specific code in
_PyImport_LoadDynamicModule(), but I'm not sure: I can't really tell what's
going on -- debugging shared libs has never been my strength ;-).

I found this out when trying to freeze a NumPy testscript on the Mac.
MacPython now has the option of creating a standalone binary without
compiler. This works because on the Mac you can merge multiple "code
fragments" (DLL's) into one file. Now, because _numpy is not imported by
any Python code, only by C code, (Mac)Freeze fails to see that the _numpy
module is being used, so it doesn't get included in the standalone app.
Kaboom!

Anyway, I don't care much about that crash, since it's easy to avoid. For
instance by adding these two lines to Numeric.py:

# make sure freeze knows _numpy is needed (it's only used by C code!)
import _numpy


Paul, would you consider adding them?

Thanks,

Just




From lbda@earthlink.net  Mon Apr 26 00:36:44 1999
From: lbda@earthlink.net (David & Laura Beth Holz)
Date: Sun, 25 Apr 1999 19:36:44 -0400
Subject: [Matrix-SIG] Numerical Integration Routines
Message-ID: <000701be8f74$7a37ad00$e7b51b26@golden>

Hi,

I just joined the Sig and wanted to use Python to do some work on my thesis.
Does anyone know if there are any numerical integration routines for
Python???  I've done a little searching, but haven't had any luck.

Thanks,

Dave Holz



From Oliphant.Travis@mayo.edu  Mon Apr 26 16:52:31 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Mon, 26 Apr 1999 10:52:31 -0500 (CDT)
Subject: [Matrix-SIG] Numerical Integration routines
Message-ID: <Pine.LNX.4.04.9904260929030.29731-100000@us2.mayo.edu>

Hi David,

Numerical Python is a good choice for your work.  (Unabashed advocacy :-)
)

I have a couple of options for you.  At http://oliphant.netpedia.net there
is a couple of pure python modules that allow you to compute integrals
using quadrature.  

I'm also about a day or two away from releasing the next version of
multipack module which contains C-extensions which are interfaces to two
generic integration routines from QUADPACK.  You will need a fortran
compiler (or f2c) to compile QUADPACK.  The quadrature functions are
already integrated and tested.  The reason the package is not released yet
is it's taking me longer to integrate an ode solver (with all of the
optional inputs and outputs) than I've had time for.  


Good luck,

Travis



From jhauser@ifm.uni-kiel.de  Tue Apr 27 00:23:37 1999
From: jhauser@ifm.uni-kiel.de (jhauser@ifm.uni-kiel.de)
Date: Tue, 27 Apr 1999 01:23:37 +0200 (CEST)
Subject: [Matrix-SIG] Interactive shell
Message-ID: <14116.62126.63884.351725@lisboa>

--PIFKdGL6u6
Content-type: text/plain; charset="us-ascii"

Hello, attached are three files which are used for a little bit
enhanced python prompt. There was some interest on the list for a more 
comfortable interactive session. This is my starting attempt with
following features.

-readline support
-completion in the local namespace with TAB
-special shell commands starting with a @
 @pwd @cd @who @whos @logon @logoff @clean
 These commands don't need ()
-logging, which can be started and stopped in the session
-keeps track of new variables
 @who 
-an example of a possible help at the prompt. type just ?
-reading of a rc file


It would be nice to hear some comments if someone really uses this,
because at the moment it works for me (TM) so will only be extended
for my personal needs.

The files are: 

ipp.py  -> the module put in your python path
ipp     -> a driver put in your bin
ipprc   -> looked for in $HOME/.ipprc

__Janko


--PIFKdGL6u6
Content-type: application/octet-stream
Content-transfer-encoding: base64
Content-Disposition: attachment;
	filename="ipp.py"

IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiMKIyBCdWlsZCBhIG5pY2UgdGV4dCBpbnRlcmZhY2Ug
dG8gUHl0aG9uCiMgVXNlIHRoZSBuZXcgc3R1ZmYgZnJvbSBjb2RlLnB5LCBuZWVkcyB0aGVy
ZWZvciBQeXRob24xLjUuMgojCmltcG9ydCBjb2RlCmltcG9ydCBvcywgY29weSwgc3RyaW5n
CgpjbGFzcyBJbnRlcmFjdGl2ZVNoZWxsKGNvZGUuSW50ZXJhY3RpdmVDb25zb2xlKToKICAg
IGxvZyA9IDAKICAgIGRlZiBfX2luaXRfXyhzZWxmLCBsb2NhbD17fSk6CiAgICAgICAgc2Vs
Zi5zYXZlX2xvY2FsID0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BACiAgICAgICAg
cGFyYW0gPSBzdHJpbmcuZmluZChsaW5lLCcoJykgCiAgICAgICAgaWYgcGFyYW0gPCAwOgog
ICAgICAgICAgICBpZiBoYXNhdHRyKHNlbGYsIGxpbmUpOgogICAgICAgICAgICAgICAgcmV0
dXJuICdzaGVsbC4nK2xpbmUrJygpJwogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAg
ICAgcmV0dXJuIGxpbmUrJygpJwogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGlmIGhhc2F0
dHIoc2VsZixsaW5lWzpwYXJhbV0pOgogICAgICAgICAgICAgICAgcmV0dXJuICdzaGVsbC4n
K2xpbmUKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJldHVybiBsaW5lCiAg
ICAgICAgICAgIAogICAgZGVmIHByZWZpbHRlcihzZWxmLCBsaW5lKToKICAgICAgICBpZiBs
aW5lIGFuZCBzdHJpbmcuc3RyaXAobGluZSlbMF0gPT0gJyEnOgogICAgICAgICAgICBzZWxm
LmhhbmRsZV9zaGVsbF9lc2NhcGUobGluZSkKICAgICAgICAgICAgcmV0dXJuICcnICMgRW1w
dHkgc3RyaW5nIGlzIG5lZWRlZCBoZXJlIQogICAgICAgIGVsaWYgbGluZSBhbmQgc3RyaW5n
LnN0cmlwKGxpbmUpWzBdID09ICc/JzoKICAgICAgICAgICAgcmV0dXJuIHNlbGYuaGFuZGxl
X2hlbHAobGluZSkKICAgICAgICBlbGlmIGxpbmUgYW5kIHN0cmluZy5zdHJpcChsaW5lKVsw
XSA9PSAnQCc6CiAgICAgICAgICAgIHJldHVybiBzZWxmLmhhbmRsZV9tYWdpYyhsaW5lKQog
ICAgICAgIGVsc2U6CiAgICAgICAgICAgIHNlbGYuX2xvZ2dlci5sb2cobGluZSkgCiAgICAg
ICAgICAgIHJldHVybiBsaW5lCgogICAgZGVmIHB3ZChzZWxmKToKICAgICAgICAiIiJSZXR1
cm4gdGhlIGN1cnJlbnQgd29ya2luZyBkaXJlY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SB8IHJlYWQgdGhpcyBhcyBpcHByYwogICAgIiIiCiAgICAjIExldCBUQUIgY29tcGxl
dGUgdGhlIGN1cnJlbnQgb2JqZWN0IG5hbWUKICAgIHJlYWRsaW5lLnBhcnNlX2FuZF9iaW5k
KCJ0YWI6IGNvbXBsZXRlIikKCgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgoKICAgIHMg
PSBzKCkKICAgICAgICAKICAgIGltcG9ydCBfX21haW5fXwogICAgc2hlbGwgPSBJbnRlcmFj
dGl2ZVNoZWxsICMgU2F2ZSBmb3IgbGF0ZXIgdXNlCiAgICBzaGVsbC51c2FnZSA9IHMudXNh
Z2UKICAgIGRlbChfX21haW5fXy5fX2RpY3RfX1sncyddKQoKICAgIHNoZWxsPXNoZWxsKGxv
Y2FsPV9fbWFpbl9fLl9fZGljdF9fKQogICAgc2hlbGwuaW50ZXJhY3QoKQo=

--PIFKdGL6u6
Content-type: application/octet-stream
Content-transfer-encoding: base64
Content-Disposition: attachment;
	filename="ipp"

IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiMKIyBEcml2ZXIgZm9yIHRoZSBpbnRlcmFjdGl2ZSBw
eXRob24gc2hlbGwuIFJlYWRzIHRoZSBjb21tYW5kIGxpbmUgYW5kCiMgZXhlY3V0ZXMgdGhl
IHJjIGZpbGUgaWYgcHJlc2VudC4gVGhlIHJjIGZpbGUgaXMgZXZhbHVhdGVkIGFmdGVyIHRo
ZQojIGNvbW1hbmQgbGluZSBvcHRpbnMsIHNvIHNvbWUgdGhpbmdzIGNhbiBiZSBzZXQgYmFj
ayBpbiB0aGUgcmMtZmlsZS4KIyBFLmcuIHRoZSBmaWxlIGxvZ2dpbmcsIGNhbiBiZSBzZXQg
YW5kIHRoZSBmaWxlIGJlIGZpeGVkIGluIHRoZSByYy1maWxlLgojCmltcG9ydCBpcHAKCnMg
PSBpcHAucygpCiAgICAKcy5vcHQgPSBzLmdldG9wdC5nZXRvcHQocy5zeXMuYXJndlsxOl0s
J2lsc2M6JykKcy5yY2ZpbGUgPSBpcHAub3MuZW52aXJvblsnSE9NRSddKycvLmlwcHJjJwpz
LnJ1biA9IHMub3B0WzFdWzpdCnMuYmVmb3JlID0gMApzLmxvZyA9ICcnCnMuYmFubmVyID0g
IlB5dGhvbiAlcyBvbiAlc1xuJXNcbiglcylcblR5cGUgPyBmb3IgbW9yZSBoZWxwXG4iICUg
KHMuc3lzLnZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuc3lzLnBsYXRmb3JtLAogICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBzLnN5cy5jb3B5cmlnaHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJUFAnKQoKCnNoZWxsID0gaXBwLklu
dGVyYWN0aXZlU2hlbGwgIyBzYXZlIHRvIG92ZXJ3cml0ZSBsYXRlcgoKZm9yIHMubyBpbiBz
Lm9wdFswXToKICAgIGlmIHMub1swXSA9PSAnLXMnOgogICAgICAgIHMucmNmaWxlID0gMAog
ICAgZWxpZiBzLm9bMF0gPT0gJy1pJzoKICAgICAgICBzLmJlZm9yZSA9IDEKICAgIGVsaWYg
cy5vWzBdID09ICctYyc6CiAgICAgICAgcy5yY2ZpbGUgPSBzLm9bMV0KICAgIGVsaWYgcy5v
WzBdID09ICctbCc6CiAgICAgICAgcy5sb2cgPSAnLmlwcC5sb2cnCiAgICBlbGlmIHMub1sw
XSA9PSAnLUwnOgogICAgICAgIHMubG9nID0gcy5vWzFdCiAgICBlbHNlOgogICAgICAgIGNv
bnRpbnVlCgppZiBzLmxvZzoKICAgICMgcmVtb3ZlIGFueSBvbGQgbG9nIGZpbGUuIFNob3Vs
ZCBvbmUgYmUgYXNrZWQ/CiAgICBpZiBzLm9zLnBhdGguaXNmaWxlKHMubG9nKToKICAgICAg
ICBzLm9zLnJlbW92ZShzLmxvZykKICAgIAppZiBzLnJjZmlsZToKICAgIHRyeToKICAgICAg
ICBleGVjZmlsZShzLnJjZmlsZSkKICAgIGV4Y2VwdCBJT0Vycm9yOgogICAgICAgIHBhc3MK
CmlmIG5vdCBzLmJlZm9yZSBhbmQgcy5vcHRbMV06CiAgICAjIE5vIGludGVyYWN0aXZlIHNl
c3Npb24gcnVuIGp1c3QgdGhlIHNjcmlwdAogICAgZm9yIHMuZmlsZSBpbiBzLnJ1bjoKICAg
ICAgICBleGVjZmlsZShzLmZpbGUpCiAgICBzLnN5cy5leGl0KCkKICAgIAppZiBzLmJlZm9y
ZToKICAgIGZvciBzLmZpbGUgaW4gcy5ydW46CiAgICAgICAgZXhlY2ZpbGUocy5maWxlKQog
ICAgCnNoZWxsLmxvZyA9IHMubG9nCnNoZWxsLmJhbm5lciA9IHMuYmFubmVyCnNoZWxsLnVz
YWdlID0gcy51c2FnZQoKaW1wb3J0IF9fbWFpbl9fCmRlbChfX21haW5fXy5fX2RpY3RfX1sn
aXBwJ10pCmRlbChfX21haW5fXy5fX2RpY3RfX1sncyddKQpzaGVsbD1zaGVsbChsb2NhbD1f
X21haW5fXy5fX2RpY3RfXykgIyBpbml0aWFsaXNlIEludGVyYWN0aXZlU2hlbGwKCnNoZWxs
LmludGVyYWN0KGJhbm5lcj1zaGVsbC5iYW5uZXIpICMgRmluaXNoISBPbmx5IGBzaGVsbGAg
cmVtYWlucyBpbiB0aGUgZ2xvYmFsIG5hbWVzcGFjZQo=

--PIFKdGL6u6
Content-type: application/octet-stream
Content-transfer-encoding: base64
Content-Disposition: attachment;
	filename=".ipprc"

IyBBbiBleGFtcGxlIHJjIGZpbGUgZm9yIHRoZSBpbnRlcmFjdGl2ZSBweXRob24gcHJvbXB0
IHByb2dyYW0uCiMgU2hvd3Mgc29tZSBvZiB0aGUgcG9zc2libGUgd2F5cyB0byBjdXN0b21p
emUgdGhlIHB5dGh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B0aGUgbmFtZXNwYWNlIGNsZWFuCg==

--PIFKdGL6u6--


From david.buscher@durham.ac.uk  Tue Apr 27 10:30:43 1999
From: david.buscher@durham.ac.uk (david.buscher@durham.ac.uk)
Date: Tue, 27 Apr 1999 10:30:43 +0100 (BST)
Subject: [Matrix-SIG] Interactive shell
In-Reply-To: <14116.62126.63884.351725@lisboa>
Message-ID: <Pine.OSF.4.05.9904271029140.29832-100000@dugem1.dur.ac.uk>

Very nice, works for me too! But people should be warned that they need
python-1.5.2 for it to work.

thanks
David

----------------------------------------+-------------------------------------
 David Buscher                          |  Phone  +44 191 374 7462
 Dept of Physics, University of Durham, |  Fax    +44 191 374 3709
 South Road, Durham DH1 3LE, UK         |  Email  david.buscher@durham.ac.uk
----------------------------------------+-------------------------------------



From KaliazinA@cardiff.ac.uk  Tue Apr 27 16:42:44 1999
From: KaliazinA@cardiff.ac.uk (Andrey Kaliazin)
Date: Tue, 27 Apr 1999 16:42:44 +0100
Subject: [Matrix-SIG] Interactive shell
References: <14116.62126.63884.351725@lisboa>
Message-ID: <002e01be90c4$9f3b3580$561afb83@engi.cf.ac.uk>

Amazingly, how much time passed since creation of Python itself, before
one bright man write such wonderful and obviously useful extension!
8-) (I mean I can't understand why this simple feature was not there
from the very beginning...)

Keep doing it!

Some suggestions:

1. let ? to give the list of all shell commands. For example? there is @dir,
which I found occasionally;
2. let ?? to give the list of all python built-ins
3. let ?some_built-in_name return its description and/or purpose ( ?nil )
4. let @dir some_module_name to give its docstring and its content without
loading that module, if it is possible.
5. for local variables let ?var to give information about the typ of the
variable
if there is no docstring available.

Andy

----- Original Message -----
From: <jhauser@ifm.uni-kiel.de>
To: Matrix-Sig <Matrix-sig@python.org>
Subject: [Matrix-SIG] Interactive shell


> Hello, attached are three files which are used for a little bit
> enhanced python prompt. There was some interest on the list for a more
> comfortable interactive session. This is my starting attempt with
> following features.
>
> -readline support
> -completion in the local namespace with TAB
> -special shell commands starting with a @
>  @pwd @cd @who @whos @logon @logoff @clean
>  These commands don't need ()
> -logging, which can be started and stopped in the session
> -keeps track of new variables
>  @who
> -an example of a possible help at the prompt. type just ?
> -reading of a rc file
>
>
> It would be nice to hear some comments if someone really uses this,
> because at the moment it works for me (TM) so will only be extended
> for my personal needs.
>
> The files are:
>
> ipp.py  -> the module put in your python path
> ipp     -> a driver put in your bin
> ipprc   -> looked for in $HOME/.ipprc
>
> __Janko
>
>





From hinsen@cnrs-orleans.fr  Wed Apr 28 20:23:17 1999
From: hinsen@cnrs-orleans.fr (Konrad Hinsen)
Date: Wed, 28 Apr 1999 21:23:17 +0200
Subject: [Matrix-SIG] Reading and handling matrices.
In-Reply-To: <Pine.LNX.3.96.990423203128.11244A-100000@saturn.astro.ufl.edu>
 (message from Christos Siopis on Fri, 23 Apr 1999 21:03:47 -0400
 (EDT))
References: <Pine.LNX.3.96.990423203128.11244A-100000@saturn.astro.ufl.edu>
Message-ID: <199904281923.VAA28192@chinon.cnrs-orleans.fr>

> minimal swapping and even on a 128 Mb machine it was bearable. With Python
> I had to resort to a 256 Mb machine (since, at one point, it has to hold
> the first array, the second array as an array, and also the second array
> as a string while conversion takes place). 

You could have done I/O piecewise:

    chunk_size = 5000 # or whatever you want
    linear = Numeric.ravel(array)
    file = open('binary_data', 'wb')
    i = 0
    while i < len(linear):
       file.write(linear[i:i+chunk_size].tostring())
       i = i + chunk_size
    file.close()

The resulting binary file should be the same, and of course you could
use a similar trick for reading.

> IMHO, binary I/O is a frequent task in data analysis and it would make
> sense to add a tofile() and a fromfile() method for NumPy arrays, even in
> the absence of any efficiency considerations... 

Some routine like the above in Numeric would probably be sufficient,
but I agree it should be there.

On a related issue: somewhat should implement a cPickle interface for
array objects. It's on my to-do list, but unfortunately not very
high up!
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------


From Oliphant.Travis@mayo.edu  Fri Apr 30 01:29:30 1999
From: Oliphant.Travis@mayo.edu (Travis Oliphant)
Date: Thu, 29 Apr 1999 19:29:30 -0500 (CDT)
Subject: [Matrix-SIG] New Multipack release
Message-ID: <Pine.LNX.4.04.9904291918450.5554-100000@us2.mayo.edu>

This announces the availability of Multipack version 0.6

Included in this release:

	fsolve -- (a nonlinear root finder for N equations)
        leastsq -- (a Levenburg-Marquardt optimizer)

        intode  -- (an ODE integrator based on lsoda including all         
                    optional inputs and outputs)
	quad   --- (a general purpose integrator, including infinite
                    limits).

The package has undergone a bit of an overhaul so that the C-code
interface does a fairly complete and basic wrap around the FORTRAN calls.
There is an addition Python-only wrapper that should be the main
user-interface.  

Documentation is hardly complete but all the information is there for
common usage.

I've built the system on RedHat Linux 5.2.  It's likely that there will be
some cross platform issues (machine specific files like d1mach) that I
would appreciate any help on.
You need a Fortran compiler to compile the source (or f2c and the
knowledge to use it.)

If you are on Linux, the binary and source RPM's on my page may be of some
use to you.

There is a test script to run that also demonstrates use.

I've been pretty impressed with the overall speed (for small problems at
least) of the FORTRAN code + python interface.  Your mileage may vary.

Have fun,

Travis