Re: It would be nice to have DiagonalMatrix accept a matrix as building
- To: mathgroup at smc.vnet.net
- Subject: [mg113541] Re: It would be nice to have DiagonalMatrix accept a matrix as building
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Tue, 2 Nov 2010 05:00:05 -0500 (EST)
Yes, obiously but I wanted it as similar as possible to the function documentation of "the other system" blkdiag(a,b,c,d,...) so that you see that you see that it's only a few letters more even *without* built-in function.. Cheers Patrick On Nov 1, 2010, at 11:02 AM, Nasser M. Abbasi wrote: > On 10/31/2010 6:47 AM, Patrick Scheibe wrote: >> Hi, >> >> aehmm, what about >> >> SparseArray[Band[{1, 1}] -> {b,b,b,b,b,b}] >> >> where b={{1, 2}, {3, 4}}? >> Takes me about 5 seconds to type. So why care that DiagonalMatrix >> can't do it? >> >> Cheers >> Patrick >> > > Well, if you wanted to repeat the block 200 times, you probably do not > want to sit and type 'b' 200 times :) > > But using ConstantArray, like Zach just mentioned is what I did not know > about. His solution: > > SparseArray[Band[{1, 1}] -> ConstantArray[block, {nBlocks}]] > > is good enough so not to require special option for DiagonalMatrix. So > this issue is closed for me. I'll use ConstantArray for this. > > Thanks for everyone input on this. > > --Nasser >