← Back to team overview

dolfin team mailing list archive

Memory access error in DenseMatrix::invert()

 

When adding the option to compile without PETSc, I took the
opportunity change the precomputation of quadrature weights for the
ODE solvers to use DenseMatrix instead of the standard PETSc
Matrix. (The matrices are small and dense anyway.)

It seems that DenseMatrix::invert() sometimes gives unexpected results
and the reason seems to be a memory access error somewhere in ublas. I
don't know if this is a problem with ublas or the way we use
it. Garth, could you look again at DenseMatrix::invert() and see if
you can spot something obvious?

I have attached the error log from running valgrind and here is the code that
reproduces the error:

   DenseMatrix A(3, 3);
   A(0, 0) = A(1, 1) = A(2, 2) = 1.0;
   A.invert();

How about adding solve(DenseVector& x, const DenseVector& b) to DenseMatrix?

/Anders

==24946== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==24946== Using LibVEX rev 1471, a library for dynamic binary translation.
==24946== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==24946== Using valgrind-3.1.0-Debian, a dynamic binary instrumentation framework.
==24946== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==24946== For more details, rerun with: -v
==24946== 
Initializing DOLFIN parameter system.
==24946== Conditional jump or move depends on uninitialised value(s)
==24946==    at 0x40847C6: boost::numeric::ublas::vector_scalar_unary_traits<boost::numeric::ublas::vector_range<boost::numeric::ublas::matrix_column<dolfin::DenseMatrix> >, boost::numeric::ublas::vector_index_norm_inf<boost::numeric::ublas::vector_range<boost::numeric::ublas::matrix_column<dolfin::DenseMatrix> >::value_type> >::result_type boost::numeric::ublas::index_norm_inf<boost::numeric::ublas::vector_range<boost::numeric::ublas::matrix_column<dolfin::DenseMatrix> > >(boost::numeric::ublas::vector_expression<boost::numeric::ublas::vector_range<boost::numeric::ublas::matrix_column<dolfin::DenseMatrix> > > const&) (functional.hpp:610)
==24946==    by 0x4085EF7: _ZN5boost7numeric5ublas12lu_factorizeIN6dolfin11DenseMatrixENS1_18permutation_matrixIjNS1_15unbounded_arrayIjSaIjEEEEEEENT_9size_typeERSA_RT0_ (lu.hpp:137)
==24946==    by 0x4079B3E: dolfin::DenseMatrix::invert() (DenseMatrix.cpp:90)
==24946==    by 0x804932D: main (main.cpp:9)
...