On Sun, 7 Jul 2019, Riccardo (Jack) Lucchetti wrote:
On Sun, 7 Jul 2019, Sven Schreiber wrote:
> Well except for F_IMAT where the second arg isn't skipped but is
> actually NULL, right?
Actually, you got me thinking about the possibility of having a second
argiment to I() (aka F_IMAT); in many cases, you want to construct a matrix
that is an identity matrix "plus some zeros"; without loss of backward
compatibility, we may introduce an optional 2nd argument to I() such that
I(r,c) returns
* I(r) ~ zeros(r, c-r) if c > r,
* I(c) | zeros(r-c, c) if r < c
and obviously I(r) if r == c; in this way, building (say) a companion matrix
would be really easy; for example,
comp = A | I(cols(A) - rows(A), cols(A))
Besides, I believe this is what Matlab does, so this would also be nice to
have when porting scripts from the Octave/Matlab galaxy.
Do you guys like the idea?
Yes. It's now in git.
Allin