Re: BZDEV: Banded matrices

From: Todd Veldhuizen (tveldhui@oonumerics.org)
Date: Thu Aug 13 1998 - 12:09:22 EST


> I have some thoughts and questions concerning banded matrices.
> I would have use for banded matrices, where the bandwidth is
> not known at compile time.
>
> Now looking at the code (0.4.2) it looks like support for banded
> matrices is not yet implemented in blitz++, but is on the to do
> list. But according to this small entry the bandwidth would have
> to be known: Banded<L,H>
>
> Scanning the sl++ code reveals that they have implemented banded
> matrix structures, but again require the bandwidth to be known
> at compile time.
>
> Now I would give it a try and implement a matrix structure for
> banded matrices that gets its bandwidth at runtime. That seems
> to be easier in blitz++ than in sl++ since blitz++ matrices
> get a structure *object* on construction, whereas sl++ matrices
> inherit the structure class and there seems to be no constructor
> that could initialize this base class with suitable data.

Sounds reasonable. You can probably use Array<T,2> to store
the data. I'd suggest using the mapping

Band Mat Array<T,2>
(i,j) -> (i,j-i+L)

where L is the lower bandwidth (not known at compile time),
and the array is of size N x (1+L+H) where H is the upper
bandwidth. This requires a bit of wasted space in the Array,
but makes indexing much simpler (and therefore efficient).

Cheers,
Todd
--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:06 EST