Hi,
I would appreciate it, if Numpy could handle the Kronecker-product of
two matrices X, Y.
kron(X,Y) is the Kronecker tensor product of X and Y.
The result is a large matrix formed by taking all possible products
between the elements of X and those of Y. If X is m-by-n
and Y is p-by-q, then kron(X,Y) is m*p-by-n*q.
Nils

Hi,
Is there any wish-list of projects and feature requests for Numpy ?
I would appreciate it, if Numpy could handle the following functions :
1. Fix eig to also be able to solve the generalized eigenvalue problem
and polynomial eigenvalue problems
2. Support for matrix functions like logm, expm, sqrtm
3. Wavelet transform
4. Solver for ODE's and DAE's
Nils Wagner

I retrieved the latest MA from CVS. I've noticed that assigning to a
slice doesn't work the same as Numeric.
Here's a simple test program:
--------------------------------
from MA import *
#from Numeric import *
numBeams,numGates = (5,4)
result = ones((numBeams, numGates),'f') * -327.68
print 'result = ', result
t1 = ones((numGates,),'f')
t2 = 2* ones((numGates,),'f')
result[0] = t1
result[1][:] = t2
print 'result = ', result
-----------------------------------------
Output using 'MA':
result = [[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]]
result = [[ 1. , 1. , 1. , 1. ,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]
[-327.68,-327.68,-327.68,-327.68,]]
However, if I use Numeric, rather than MA, I get:
result = [[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]]
result = [[ 1. 1. 1. 1. ]
[ 2. 2. 2. 2. ]
[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]
[-327.68 -327.68 -327.68 -327.68]]
So,
a[x][:] = my_array
doesn't seem to work using 'MA'.
--
Joe VanAndel
National Center for Atmospheric Research
http://www.atd.ucar.edu/~vanandel/
Internet: vanandel(a)ucar.edu

I receive a steady stream of questions sent to me about Numerical Python.
Frequently, in their zeal to protect themselves from spam, the senders
obscure their sending address. This causes my reply to bounce.
I sometimes drop the ball and fail to reply promptly due to the volume of
letters I receive, advancing senility, or because the question requires
research and it goes onto my stack for too long. But before you conclude
that I'm not answering you because of ineptitude, please be sure I *can*
answer your mail with a simple reply.
Thanks,
Paul

Dear All,
I have had some problems with
Cannot export _bss_end__: symbol not defined
messages and friends again for the cvs Numerical Python package.
Although the LAPACK-module uses the DL_EXPORT approach and works fine,
the other packages apparently try the .def-approach (which I barely
heard about); this packages do not build for me on latest Cygwin. (I
have not tried it on older ones.)
Putting DL_EXPORTs around all the init-functions fixes this for me:
Index: Packages/FFT/Src/fftpackmodule.c
===================================================================
RCS file: /cvsroot/numpy/Numerical/Packages/FFT/Src/fftpackmodule.c,v
retrieving revision 1.1
diff -u -r1.1 fftpackmodule.c
--- Packages/FFT/Src/fftpackmodule.c 2000/07/06 16:54:16 1.1
+++ Packages/FFT/Src/fftpackmodule.c 2001/07/03 14:06:48
@@ -238,7 +238,7 @@
""
;
-void
+DL_EXPORT(void)
initfftpack()
{
PyObject *m, *d;
Index: Packages/RNG/Src/RNGmodule.c
===================================================================
RCS file: /cvsroot/numpy/Numerical/Packages/RNG/Src/RNGmodule.c,v
retrieving revision 1.1
diff -u -r1.1 RNGmodule.c
--- Packages/RNG/Src/RNGmodule.c 2000/07/06 16:54:17 1.1
+++ Packages/RNG/Src/RNGmodule.c 2001/07/03 14:06:49
@@ -613,7 +613,7 @@
"Random number generator: independent random number streams."
;
-void
+DL_EXPORT(void)
initRNG()
{
PyObject *m, *d;
Index: Packages/kinds/Src/_kindsmodule.c
===================================================================
RCS file: /cvsroot/numpy/Numerical/Packages/kinds/Src/_kindsmodule.c,v
retrieving revision 1.1
diff -u -r1.1 _kindsmodule.c
--- Packages/kinds/Src/_kindsmodule.c 2001/04/17 23:35:10 1.1
+++ Packages/kinds/Src/_kindsmodule.c 2001/07/03 14:06:49
@@ -10,7 +10,7 @@
{NULL, NULL, 0} /* sentinel */
};
-void
+DL_EXPORT(void)
init_kinds()
{
PyObject *m, *d;
Greetings,
Jochen
--
Einigkeit und Recht und Freiheit http://www.Jochen-Kuepper.de
Liberté, Égalité, Fraternité GnuPG key: 44BCCD8E
Sex, drugs and rock-n-roll

I'm pleased to announce the new release of Scigraphica with bugfixes and
enhancements.
Among other things, embedding images is now possible, as well as setting
background images for the plots. Clipboard for plots: copy a plot, and
paste it on a different plot window. Improved PostScript and WYSIWYG.
It includes pysga.py, a Python module for interacting with plots and
worksheets from terminal. New scheme for storing numerical data in
worksheets. Examples are included.
Scigraphica is a powerful tool for scientific graphics and data analysis.
It pretends to be a clone of the popular commercial (and expensive)
application "Microcal Origin". It fully supplies plotting features for 2D,
3D and polar charts.
The aim is to obtain a fully-featured, cross-plattform, user-friendly,
self-growing scientific application. It is free and open-source, released
under the GPL license.
Main features:
-You can plot functions and manipulate data in worksheets.
-You can open several worksheets and plots and work with them at the same
time.
-The plots are fully configurable using a control panel dialog.
-The look and feel is completely WYSIWYG.
-Publication quality PostScript output.
-You can interact with the plots double-clicking, dragging and moving
objects with the mouse.
-Export/Import features in XML format.
-You can insert Python expressions in the worksheets.
-Terminal with command-line Python interface for interacting with plots
and worksheets
URL: http://scigraphica.sourceforge.net
Enjoy!
The SciGraphica Team.-
------------------------------------------------------------------------
TODO for sg-0.8.0:
sg-0.8.0 will have a completely different structure, more modular, built
ontop of reusable libraries. SGplot, SGworksheet, SGlayer, and SGdataset
will be GtkWidgets and part of a shareable library, that could be used by
other applications, and from Python.

I did some experimenting with the NumPy C API. I wrote two functions.
One for processing a NumPy array in C++ and the other one for
generating a NumPy array in C++. The processing function work perfectly
fine. But in the array-generating function I get a segmentation fault
whenever I call PyArray_FromDims. I used swig for generating the wrapper
functions.
The two src-files (numPyExt.i and numPyExt.cc):
--- begin numPyExt.i -------------------------------------------------
%module numPyExt
%{
#include <iostream.h>
#include <Python.h>
#include <Numeric/arrayobject.h>
%}
%init %{
import_array();
%}
%typemap(python,in) double * {
PyArrayObject *py_arr;
if(!PyArray_Check($source)) {
PyErr_SetString(PyExc_TypeError, "Not a NumPy array");
return NULL;
}
if (PyArray_ObjectType($source,0) != PyArray_DOUBLE) {
PyErr_SetString(PyExc_ValueError, "Array must be of type double");
return NULL;
}
py_arr = (PyArrayObject*) \
(PyArray_ContiguousFromObject($source, PyArray_DOUBLE, 1, 1));
if (py_arr->nd != 1) {
PyErr_SetString(PyExc_TypeError, "Array must be 1D");
return NULL;
}
$target = (double*)(py_arr->data);
}
extern PyObject* createArray();
extern void processArray(double* pdInArray);
--- end numPyExt.i ---------------------------------------------------
--- begin numPyExt.cc ------------------------------------------------
#include <iostream.h>
#include <Python.h>
#include <Numeric/arrayobject.h>
//------
PyObject* createArray() {
PyArrayObject* retArray;
int iDimensions[3] = {10, 10, 10};
cout << "before PyArray_FromDims" << endl << flush;
retArray = (PyArrayObject*)PyArray_FromDims(3, iDimensions, PyArray_INT);
cout << "after PyArray_FromDims" << endl << flush;
return PyArray_Return(retArray);
}
//------
void processArray(double* pdInArray) {
cout << *pdInArray << " " << *(pdInArray+1) << " " << *(pdInArray+2)
<< endl;
}
--- end numPyExt.cc --------------------------------------------------
Compiled with:
g++ -c -I/usr/local/include/python2.0 -I/usr/local/lib/python2.0/site-packages -O2 numPyExt.cc
swig -python -c++ numPyExt.i
g++ -c -O2 numPyExt_wrap.c -DOS_LINUX -DHAVE_CONFIG_H -I. -I/usr/local/include/python2.0 -I/usr/local/lib/python2.0/site-packages -I/usr/local/lib/python2.0/config
g++ -W1,--heap,50000,--stack,100000 -O2 -shared numPyExt.o numPyExt_wrap.o -lstdc++ -o numPyExt.so
The Python test code I am using:
import Numeric, numPyExt
vec = Numeric.array((1.23, 4.56, 7.89))
numPyExt.processArray(vec) # works fine
a = numPyExt.createArray() # seg fault here
print a
I am using NumPy v20.0.0, Python 2.1, and gcc 2.95.2 on a Linux 2.2.16
sytem.
Does anybody have an idea what's causing this problem?
Juerg