Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: simpler way to get a particular banded matrix?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98103] Re: [mg98079] simpler way to get a particular banded matrix?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 30 Mar 2009 04:43:41 -0500 (EST)
  • Reply-to: hanlonr at cox.net

H = {h0, h1, h2, h3, h4, h5};
rH = Reverse[H];
z = Table[0, {5}];

Take[#, -6] & /@
 NestList[RotateRight[#, 2] &, Join[rH, z], 5]

Table[Take[Join[z, rH, z], {13, 18} - 2 n], {n, 6}]


Bob Hanlon

---- rip pelletier <bitbucket at comcast.net> wrote: 

=============
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



  • Prev by Date: Re: HoldAll for Integrate
  • Next by Date: Image Processing & 3D Graphics Question
  • Previous by thread: simpler way to get a particular banded matrix?
  • Next by thread: Re: simpler way to get a particular banded matrix?