|
Boost : |
From: walter_at_[hidden]
Date: 2001-12-04 04:12:57
--- In boost_at_y..., Peter Schmitteckert (boost) <boost_at_s...> wrote:
> Salut,
>
> On Sunday 02 December 2001 10:39, walter_at_g... wrote:
>
> > I'm rather sure, that we should try to go with double d = real (hm
> > (i, i)). Isn't that similar enough to double d = hm.diag (i)?
There
> > also is an open issue with proxies like diag, which I'll address
in
> > another posting.
>
> In my old code, for HMatrix< complex<double> > ,
> I had a complex array for the off-diagonal elements,
> and a double* for the diagonal part. You may call it a premature
> optimization,
Of course ;-). Shouldn't our storage layout be Fortran BLAS
compatible?
> it's the opposite way, returing
> complex<T>( diag(i), 0) for the value of an iterator.
>
> > The type of the scalar in hermitean_matrix *= scalar is a template
> > argument. So it should be no problem to write hm *= d;
>
> Sure, but multiplying with a complex number is likely to be an error
> and the user should be notified,
Yes.
> ot the result should be a general
> matrix, not a hermitean one,
Please, don't mix assignment and computed assignment. I currently see
the following cases:
Computed assign:
hermitean_matrix *= double_scalar, no problem
hermitean_matrix *= complex_scalar, precondition: assert (imag
(complex_scalar) == 0)
Assign:
hermitean_matrix2 = double_scalar * hermitean_matrix1, no problem
hermitean_matrix2 = complex_scalar * hermitean_matrix1,
postcondition: assert (imag (hermitean_matrix2 (i, i)) == 0)
general_matrix = complex_scalar * hermitean_matrix, no problem
> while multiplying with a real scalar
> should return a hermitean matrix. Maybe the savings for dense
> hermitean matrix is not worth the optimization, but for large
> tri-diagonal hermitean matrices it makes a difference.
>
> > Yes (although we're losing one of our rare users ;-).
> Don't worry, I'll declare it as "user feedback" :).
>
> > P.S.: Did you consider to use hermitean_adaptor<banded_matrix<> >?
> Please excuse, currently I have a very limited knowledge of
> the ublas library. I performed a cross-read of the documentation
> only. But I will reread it.
Sorry, documentation is slightly outdated and incomplete. Therefore I
mentioned hermitean_adaptor. For all packed matrix types currently
supported (banded_matrix, triangular_matrix, symmetric_matrix,
hermitean_matrix) we provide a proxy class (banded_adaptor,
triangular_adaptor, symmetric_adaptor, hermitean_adaptor), which
allows to address the corresponding view of a referenced matrix. So
if you use hermitean_adaptor<banded_matrix<> >, you already should be
able to work with an hermitean banded matrix stored in the upper or
lower triangular part of a banded matrix.
Regards
Joerg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk