dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02337
Re: [HG] merge
On Wed, 2006-04-05 at 16:04 +0200, Garth N. Wells wrote:
> I've added a bunch of tests for DenseMatrix. You can find them in
> src/test.
>
> I've tested (a) DenseMatrix derived from uBlas, (b) DenseMatrix class
> derived from GenericMatrix and uBlas, and (c) NewMatrix class with a
> pointer to GenericMatrix.
>
> In summary,
>
> - When using wrapper functions for uBlas to access individual elements,
> the overhead is exactly a factor 2. I guess this is not surprising -
> double the number of function calls.
>
The overhead is due to using virtual functions, not wrapping functions.
When turning off uBlas debug directives, the cost of using virtual
functions blows out to a factor of 15! When functions are not made
virtual in the base class and simply overridden in the derived class,
there doesn't appear to be any extra cost due to wrapping functions.
Garth
> - When wrapping other functions, the overhead is negligible.
>
> - For the "=" operator, it faster when this is wrapped in the derived
> classes.
> boost::numeric::ublas::matrix<real>& operator= (DenseMatrix& A)
> { return boost::numeric::ublas::matrix<real>::operator = (A) ; };
> I don't know why this is??
>
> An approach could be to design Matrix class which is similar to Function
> (but it would be simpler) so that both dense and sparse matrices can be
> assembled, but not supply virtual functions to access individual
> elements. This is to avoid the need to wrap the functions for accessing
> elements. When a user wants to work directly with dense matrices (or
> sparse matrices), they can create a DenseMatrix which allows access to
> all the uBlas functions. Not a nice solution, but any ideas?
>
> Garth
>
>
>
>
> Garth
>
>
>
>
>
> On Wed, 2006-04-05 at 14:49 +0200, DOLFIN wrote:
> > One or more new changesets pushed to the primary DOLFIN repository.
> > A short summary of the last three changesets is included below.
> >
> > changeset: 1843:a665e3cd78c7ec75ef59cf6f61f26c24630a1f22
> > tag: tip
> > parent: 1842:05da1868689e5ec15c64172ce8f8d56ab9a65ad0
> > parent: 1841:80c6859e328196bae99a9f15d475a3fae5b60f83
> > user: "Garth N. Wells <g.n.wells@xxxxxxxxxx>"
> > date: Wed Apr 5 14:48:52 2006 +0200
> > files:
> > description:
> > merge
> >
> >
> > changeset: 1842:05da1868689e5ec15c64172ce8f8d56ab9a65ad0
> > parent: 1840:68273b564ad1f4a511c52cb77819dfc891ea12a6
> > user: "Garth N. Wells <g.n.wells@xxxxxxxxxx>"
> > date: Wed Apr 5 14:46:59 2006 +0200
> > files: src/kernel/la/DenseMatrix.cpp src/kernel/la/dolfin/DenseMatrix.h src/test/main.cpp
> > description:
> > Testing of DenseMatrix class.
> >
> >
> > changeset: 1841:80c6859e328196bae99a9f15d475a3fae5b60f83
> > user: "Anders Logg <logg@xxxxxxxxx>"
> > date: Tue Apr 4 23:35:57 2006 -0500
> > files: ChangeLog TODO
> > description:
> > Update ChangeLog and TODO list
> >
> >
> > -------------------------------------------------------
> > For more details, visit http://www.fenics.org/hg/dolfin
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
>
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
References