thank you very much!
By the way, how to get the diagonal matrix from vector diag(A)?
2013/12/13 Sven Schreiber <svetosch(a)gmx.net>
> Am 13.12.2013 16:00, schrieb Qi Shi:
> > Dear all,
> >
> > how to transform a square matrix to a diagonal matrix using commands?
> > for example, we have A={2,1;1,3}, how can I get a matrix B={2,0;0,3}?
> >
>
> For example:
>
> diag(A)**ones(1,cols(A)) .* I(cols(A))
>
> I'm not guaranteeing that this is the most elegant way, but in general
> you should probably think about whether extracting diag(A) isn't enough
> for your purposes, because it contains the same information.
>
> -sven
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
>
http://lists.wfu.edu/mailman/listinfo/gretl-users
>