simpler way to get a particular banded matrix?
- To: mathgroup at smc.vnet.net
- Subject: [mg98079] simpler way to get a particular banded matrix?
- From: rip pelletier <bitbucket at comcast.net>
- Date: Sun, 29 Mar 2009 02:48:12 -0500 (EST)
Hi,
The following command constructs a matrix (typically denoted M0, it
arises in filter banks in general, in Burrus, Gopinath, & Guo "intro to
wavelets and wavelet transforms: a primer" in particular).
I'm sure there's a way to do this without typing out all 5 bands. Here's
what i did:
SparseArray[Band[{1,1}]->H,{6,6}]+
SparseArray[Band[{2,3}]->H,{6,6}]+
SparseArray[Band[{3,5}]->H,{6,6}]+
SparseArray[Band[{-2,-3},{1,1},{-1,-1}]->rH,{6,6}]+
SparseArray[Band[{-3,-5},{1,1},{-1,-1}]->rH,{6,6}]
where
H={h0,h1,h2,h3,h4,h5};
rH=Reverse[H];
I get what I want:
h0 0 0 0 0 0
h2 h1 h0 0 0 0
h4 h3 h2 h1 h0 0
0 h5 h4 h3 h2 h1
0 0 0 h5 h4 h3
0 0 0 0 0 h5
Any easier ways to get this?
TIA and vale,
rip
--
NB eddress is r i p 1 AT c o m c a s t DOT n e t