← Back to team overview

ffc team mailing list archive

Re: problem with ffc and numeric

 

On Tue, May 02, 2006 at 01:11:47PM +0000, Alexander Jarosch wrote:
> 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*
> >>> from FIAT.shapes import *
> >>> element = VectorLagrange(TRIANGLE, 2)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  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
> >>>
> 
> 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

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


> Anders Logg wrote:
> 
> >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:
> > 
> >
> >>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/
> >>
> >>
> >>_______________________________________________
> >>FFC-dev mailing list
> >>FFC-dev@xxxxxxxxxx
> >>http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
> >>   
> >>
> >
> > 
> >
> 
> 
> -- 
> 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/
> 



Follow ups

References