[Gretl-users] diagcat

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Fri Sep 28 04:33:12 EDT 2012

On Fri, 28 Sep 2012, Sven Schreiber wrote:

> Good morning,
> I just noticed the new (?) function diagcat() with the following help text:
> "Returns the direct sum of A and B, that is a block-diagonal matrix
> holding A in its north-west corner and B in its south-east corner. "
> Why would that be a _sum_?

Because that's its name :)


Intuitively, you can think of this operator as a sum if you view matrices 
as the space spanned by their columns. The direct sum of two matrices 
results in a space which is equal to the two original spaces "put 
together", so to speak.

> Also, what happens if A and B are not square? (I know, I could just try
> that out, but too lazy, and that wouldn't necessarily answer what's
> intended as a result.)

Nothing spectacular. You just have non-square zero blocks in the 
north-east and south-west corners of the result.

> And while I'm at it: I also noticed trimr() which trims rows. Don't know
> whether that's new, but why introduce a special function for this
> operation, couldn't it always be easily done by indexing, as in
> M[ttop+1:rows(M)-tbot] ?

It's been around for a while. Maybe you're right. We may want to suppress 
a few redundant functions for 2.0.

  Riccardo (Jack) Lucchetti
  Dipartimento di Economia

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti at univpm.it

More information about the Gretl-users mailing list