[Dune] Strange behaviour of BCRSMatrix

Oliver Sander sander at math.fu-berlin.de
Thu Dec 2 17:26:15 CET 2004


Hi guys!
I'd like to point out what I consider a flaw (if not a bug) in
BCRSMatrix.

Consider the following code:

    BCRSMatrix<FieldMatrix<double, 3, 3> > matrix(10, 10, ...);

    std::cout << "coldim: " << matrix.coldim() << std::endl;

We would always expect the output '30'.  However, coldim()
does nothing but call coldim(i) for all columns i and
sum up the result.  And coldim(int i) returns zero if a
column doesn't contain any entries!!!  Which may well
happen.  But we _know_ that columns have width 3.

So what should be done?  I think just tacitly returning the
wrong result is a bad idea.  However, Peter wanted to be
able to instantiate BCRSMatrix with elements of dynamic
size, right?  So we can't just write

int coldim(int i) {
    return B::coldim();
}

Suggestions?
Oliver



************************************************************************
* Oliver Sander                **                                      *
* Freie Universität Berlin     ** email: sander at math.fu-berlin.de      *
* Institut für Mathematik II   ** phone: + 49 (30) 838 75217           *
* Arnimallee 2-6               ** fax  : + 49 (30) 838 54977           *
* 14195 Berlin, Germany        ** URL  : www.math.fu-berlin.de/~sander *
************************************************************************


More information about the Dune mailing list