Subject: [FFC-dev] problem with ffc and numeric

From: Alexander Jarosch <[email-masked]>
Date: Tue, 02 May 2006 09:48:40 +0000

Hello everybody,

I just pulled the recent ffc and tried to compile a form, but I get the 
output:

# ffc -d 3 Stokes.form
This is FFC, the FEniCS Form Compiler, version 0.3.2.
For further information, go to http://www/fenics.org/ffc/.
Parsing Stokes.form
Output written to Stokes.py
Traceback (most recent call last):
  File "/usr/bin/ffc", line 125, in ?
    main(sys.argv[1:])
  File "/usr/bin/ffc", line 82, in main
    execfile(outname, ns)
  File "Stokes.py", line 21, in ?
    P2 = FiniteElement("Vector Lagrange", "triangle", 2)
  File "/usr/lib/python2.4/site-packages/ffc/compiler/finiteelement.py", 
line 
73                                                                                                                                

, in __init__
    self.element = VectorLagrange(self.fiat_shape, degree, num_components)
  File "/usr/lib/python2.4/site-packages/FIAT/Lagrange.py", line 108, in 
__init_                                                                                                                                

_
    U = polynomial.OrthogonalPolynomialArraySet( shape , n , nc )
  File "/usr/lib/python2.4/site-packages/FIAT/polynomial.py", line 394, 
in 
Ortho                                                                                                                                

gonalPolynomialArraySet
    b = PolynomialBase( element_shape , degree )
  File "/usr/lib/python2.4/site-packages/FIAT/polynomial.py", line 29, 
in 
__init                                                                                                                                

__
    vinv = LinearAlgebra.inverse( v )
  File "/usr/lib64/python2.4/site-packages/Numeric/LinearAlgebra.py", 
line 
108,                                                                                                                                 

in inverse
    return solve_linear_equations(a, Numeric.identity(a.shape[0]))
  File "/usr/lib64/python2.4/site-packages/Numeric/Numeric.py", line 
604, in 
ide                                                                                                                                

ntity
    return resize(array([1]+n*[0],typecode=typecode), (n,n))
  File "/usr/lib64/python2.4/site-packages/Numeric/Numeric.py", line 
398, in 
res                                                                                                                                

ize
    return reshape(a, new_shape)
ValueError: total size of new array must be unchanged

looks like a numeric package problem, but I have to say, I'm stuck here. 
Does anybody have an idea what to do? I use python 2.4 and the numeric 
package 23.7

thanks in advance

Alex

-- 
Alexander H. Jarosch

Jarðvísindastofnun Háskólans
Institute of Earth Sciences, University of Iceland
Náttúrufræðahús, Askja
Building of Natural Sciences, Askja
Sturlugata 7
IS - 101 Reykjavík
Iceland

Tel.: +354 525 4906
http://raunvis.hi.is/~jarosch/

---

From: Anders Logg <[email-masked]>
Date: Tue, 2 May 2006 14:40:30 +0200

Can you try the following (in Python) and see if you get the same
error. In that case, we can nail it down to a FIAT problem, which
would be good since then it would be Rob's problem and not mine. :-)

from FIAT.Lagrange import *
from FIAT.shapes import *

element = VectorLagrange(TRIANGLE, 2)

/Anders

On Tue, May 02, 2006 at 09:48:40AM +0000, Alexander Jarosch wrote:
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev

---

From: Alexander Jarosch <[email-masked]>
Date: Tue, 02 May 2006 13:11:47 +0000

Yups, did it and get this:

Python 2.4.2 (#1, May  1 2006, 12:35:13)
[GCC 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from FIAT.Lagrange import*
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/FIAT/Lagrange.py", line 108, in 
__init_                                                                                                                                

_

gonalPolynomialArraySet

__

in inverse

ntity

ize

so it seems that it is not your problem, well shall I post it on the 
FIAT list or does Rob get it through this one?

Alex

-- 
Alexander H. Jarosch

Tel.: +354 525 4906

---

From: Anders Logg <[email-masked]>
Date: Tue, 2 May 2006 15:27:13 +0200

> FIAT list or does Rob get it through this one?

He read this list last time I checked so no need to resend it I think.
Most likely, he'll say it's a bug in LinearAlgebra.

You could try to edit 

    /usr/lib/python2.4/site-packages/FIAT/polynomial.py

and add a line

    print v

just before vinv = LinearAlgebra.inverse( v ) line 29.

Then enter that same matrix in Python without FIAT and see if you still
get the same error:

from LinearAlgebra import *

v = [[..., ...], [..., ...], ... ]
inverse(v)

That way you have nailed it down to a problem with Python LinearAlgebra.

/Anders

---

From: "Robert C. Kirby" <[email-masked]>
Date: Tue, 2 May 2006 10:52:36 -0500

The same code works fine for me.  I am using Python 2.3.5 on a Mac.   
Python and the Numeric/LinearAlgebra extension were built with GCC  
4.0.1.

Also works fine on the Debian Python 2.3.4 on our department Linux  
machines (built with gcc 3.3.5).

Since it seems to be dying on the reshape, it makes sense to print  
out a.shape and newshape and see if their product is the same
print reduce(lambda x,y:x*y , a.shape)
print reduce(lambda x,y:x*y, newshape)

Also check to see if the problem is in the gentoo package?

Rob

---

From: Alexander Jarosch <[email-masked]>
Date: Tue, 02 May 2006 19:54:58 +0000

It works fine on my 32 bit gentoo, with same numeric package, gcc 3.4.4 
and Python 2.4.2. The problem causes a 64bit amd gentoo. well I will 
further investigate and let you know

Alex

-- 
Alexander H. Jarosch

Tel.: +354 525 4906