|
Ublas : |
From: Sorkin Dima (dsorkin_at_[hidden])
Date: 2006-10-13 07:05:40
On Thu, 12 Oct 2006, James N. Knight wrote:
> Thanks for the reply. I'm going think more about a block matrix structure.
> I think this is a nice approach and should be easy to add to the ublas framework.
Hi.
Just pay attention that uBLAS matrix is already a block matrix, as it
is templated on it's stored type "T". Copy semantics is implemented,
i.e. it stores a copy of "T".
Ideally "T" could be a matrix too.
Two problems prevent the use of uBLAS matrix as a block matrix as is:
1) The problem of initialization of entries (there were long discussions
on this forum about it)
2) Promotion traits of types, i.e. when multiplying two matrices, how do
you calculate the _type_ of the resulting expression. uBLAS have no
mechanism to provide the type of the result (besides the internal
traits class), and implementing it is too much effort (today), as
changes are deep.
Implementing reference semantics seems to be easy with the existing code -
you need to store wrappers that hold (smart) pointers to the subblock
matrices. And you have to add the templates for these wrappers into the
promotion traits system of uBLAS. The resulting code should work as is.
Regards,
Dima.