Numerical Python Question

Uwe Schmitt uwe at rocksport.de
Tue Dec 4 07:15:21 EST 2001


Hi,

I tried the following code:


    from Numeric import *
    from Matrix import *

    n=5

    hilb=zeros((n,n),Float)

    for i in range(n):
	for j in range(n):
	    val= 1.0/(i+j+1)
	    hilb[i,j]=val

    x=ones((n,1),Float)

    b=hilb*x 

    print "x= ", x

    print "b= ", b


As hilb is a n x n matrix and x is n x 1 the result b should be n x 1.
But the program outputs a n x n matrix !!!

Is this a bug, or did I miss something ?

Greetings, Uwe.

-- 
Dr. rer. nat. Uwe Schmitt                       Uwe.Schmitt at num.uni-sb.de
Universitaet des Saarlandes                     Angewandte Mathematik
Building 36.1 Room 4.17         PO-Box 151150   D-66041 Saarbruecken
Mobile:0177/6806587    Fax:+49(0)681/302-4435   Office:+49(0)681/302-2468



More information about the Python-list mailing list