 
 
 
 
 
 
Re: It would be nice to have DiagonalMatrix accept a matrix as building
- To: mathgroup at smc.vnet.net
- Subject: [mg113547] Re: It would be nice to have DiagonalMatrix accept a matrix as building
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Tue, 2 Nov 2010 05:01:11 -0500 (EST)
- References: <iajcai$p6j$1@smc.vnet.net> <iam31c$jts$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 11/1/2010 2:59 AM, Sjoerd C. de Vries wrote:
> What's common for you may be rare for someone else. Personally, in the
> last 20 or so years I've never encountered the need for such a
> function.
Then you must not work in the same as I do? This is very common in 
building the system matrix for finite difference schemes for example 
where many matrices have banded blocked structure.
> So, I'd say it seems a bit unreasonable to demand that
Where did this "demand" come from?  Where did I demand anything? Look at 
the title. I said "it would be nice". How did you change this to 
"demand" I have no idea. You must use a different dictionary.
> Wolfram should do this or that because you yourself are in need of a
> certain function, particularly when it is so easy to write
>
> diagonalMatrix[mat_?MatrixQ, n_] :=
>   Module[{m},
>    dm = DiagonalMatrix[Table[m, {n}]];
>    ArrayFlatten[dm /. m ->  mat]
>    ]
>
> diagonalMatrix[{{1, 2, 5}, {3, 4, 5}}, 10] // MatrixForm
>
> Cheers -- Sjoerd
>
You could have provided the answer above, without all that unnecessary 
editorial lecturing.
--Nasser

