dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02341
Re: [HG] Create template class NewMatrix.
On Thu, Apr 06, 2006 at 05:20:00PM +0200, Garth N. Wells wrote:
> I've created a NewMatrix template to allow a matrix to be created which
> is either dense or sparse. Some benchmarks are in src/test/main.cpp for
>
> NewMatrix<DenseMatrix> A;
>
> There is no overhead when operating on A with respect to directly
> creating a uBlas matrix and operating on it.
Very good!
The only drawback as I see it compared to the envelope-letter design
is that we can't change the storage dynamically, but we can probably
live without that.
It should be enough if we provide functionality for converting from
one type to the other.
> I suggest putting the necessary functions which are common to dense and
> sparse matrices into NewMatrix, and changing the name of Matrix to
> SparseMatrix, and creating a similar template for vectors. Any
> objections or suggestions?
>
> Garth
No objections. This sounds like a very good solution.
One of the functions we need to have is Matrix::add() for assembly.
Is it possible to set a default type? So one would do just
Matrix A;
to get a sparse matrix and would need to do something different to get
a dense one. I'd prefer something else than Matrix<DenseMatrix>,
perhaps
Matrix<dense> A;
if possible.
Or we could rename the DenseMatrix and SparseMatrix classes to
something like
DenseMatrixImplementation / SparseMatrixImplementation
DenseMatrixStorage / SparseMatrixStorage
DenseMatrixReal / SparseMatrixReal
other options?
and then do
typedef MatrixInterface<DenseMatrixImplementation> DenseMatrix;
typedef MatrixInterface<SparseMatrixImplementation> SparseMatrix;
typedef MatrixInterface<SparseMatrixImplementation> Matrix
where MatrixInterface is the name of the template NewMatrix after we
rename it.
This would make it easy for the user to create matrices, but it would
make life harder for us when we write functions that take a general
matrix (sparse or dense) as an argument, but we can probably find a
nice solution for that too...
/Anders
>
> On Thu, 2006-04-06 at 16:50 +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: 1845:4c75b74c95a56c23f1bb6d073c7e8261515a2ffd
> > tag: tip
> > user: "Garth N. Wells <g.n.wells@xxxxxxxxxx>"
> > date: Thu Apr 6 16:49:50 2006 +0200
> > files: configure configure.ac src/kernel/la/DenseMatrix.cpp src/kernel/la/Makefile.am src/kernel/la/Makefile.in src/kernel/la/dolfin/DenseMatrix.h src/kernel/la/dolfin/Makefile.am src/kernel/la/dolfin/Makefile.in src/kernel/la/dolfin/dolfin_la.h src/test/main.cpp
> > description:
> > Create template class NewMatrix.
> >
> >
> > changeset: 1844:6b24c4aa352caa578d97cf8eee398793f9a65499
> > user: "Anders Logg <logg@xxxxxxxxx>"
> > date: Wed Apr 5 16:37:57 2006 -0500
> > files: configure configure.ac
> > description:
> > Remove -Werror when compiling with --enable-optimization
> >
> >
> > changeset: 1843:a665e3cd78c7ec75ef59cf6f61f26c24630a1f22
> > 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
> >
> >
> > -------------------------------------------------------
> > 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
>
--
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/
Follow ups
References