Boost logo

Boost :

From: walter_at_[hidden]
Date: 2001-11-29 16:48:32

--- In boost_at_y..., Peter Schmitteckert (boost) <boost_at_s...> wrote:
> Dear all,
> I've started to take a closer look at the ublas library.
> First of all, I'm quite impressed by sources, which are
> very readable.
> However, I'm currently only at the lowest
> level of understanding ublas.
> I have the the following questions / comments concerning
> the hermitean matrices:
> -> Is it correct, that the diagonal elements are of the
> same type as the off-diagonal elements, or have I missed
> missed something?

Yes, all elements are complex (if value_type is complex<> ;-).
> I'd prefer the diagonal elements of a complex hermitean
> matrix to be real. Or at least to have a function
> returning the diagonal elements as real values.

How would you design the corresponding iterator interface using real
diagonal elements? Shouldn't we better assert, that imag (m [i] [i])
== 0? I'll think about an special accessor for diagonal elements.
> -> In the same spirit one should not be allowed to
> multiply a complex hermitean matrix with a non-real
> scalar, or at least this shouldn't return a hermitean matrix.

The most critical part here is hermitean_matrix *= scalar. Again I'd
prefer to assert that imag (scalar) == 0.
> -> Shouldn't hermitean matrices be square matrices ?

Yuk. I'll change that accordingly (for symmetric matrices likewise).
> -> Suppose I want to implement a banded hermitean matrix.
> What do I need besides corresponding functors ?

I think, you'll need to modify or extend the storage layout functors
only, if you intend to support banded hermitean matrices with column
and row major storage for example.
I imagine, that deriving banded_hermitean_matrix (or
hermitean_banded_matrix :-) statically from matrix_expression should
give you the neccessary ET support.
A hint: may be you better try to implement a somewhat simpler form
like skew_hermitean_matrix ;-) first.
Thanks for your feedback.

Boost list run by bdawes at, gregod at, cpdaniel at, john at