← Back to team overview

dolfin team mailing list archive

Re: More linear algebra...

 

Anders Logg wrote:
Some more inconsistencies in the linear algebra interface:

1. In GenericVector, there's an operator() but not in GenericMatrix.
Should we add one to GenericMatrix?


This is used in applying Dirichlet boundary conditions. Rather than adding operator() to GenericMatrix, I would consider removing it from GenericVector (and making some changes in the class FEM for applying Dirichlet boundary conditions).


2. Should we make it assignable? This would require the
GenericMatrix::Element trick. Maybe it's ok since this is just a fix
for the C++ interface? Indexing in the Python interface is handled
differently anyway.

3. Are all the functions in GenericMatrix/Vector necessary? Could some
be removed?

At a glance, I'd say that they are all necessary for assmebly.

Also, there are plenty of functions in PETScMatrix/Vector
and uBlasMatrix/Vector that are not in GenericMatrix/Vector. Should we
make sure that the interface stays the same for all linear algebra
types so for example only GenericMatrix functions are present in the
public interface of PETScMatrix?

It could be expanded (particularly GenericVector), but I would still try to keep it compact. Some basic algebra operations would be good (+, +=, -, -=, *=). They are used at least in src/modules/elasticity.

Ideally, if a Matrix/Vector is created all the members functions which are called should be in GenericMatrix/Vector, and if specialised functions are required, a PETScMatrix/Vector or uBlasMatrix/Vector should be created. Is it possible somehow to "hide" member functions of PETScMatrix/uBlasMatrix which are not in GenericMatrix/Vector when using a Matrix/Vector?

Garth


4. Indexing in a PETSc matrix does not work as expected:

  >>> from dolfin import *
  >>> A = Matrix(10, 10)
  >>> print A[(5,5)]
  [0]PETSC ERROR: MatGetValues() line 1324 in src/mat/interface/matrix.c
  [0]PETSC ERROR: Object is in wrong state!
  [0]PETSC ERROR: Not for unassembled matrix!
  1.27319747458e-313

The natural would be for this to return zero.

/Anders
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References