On Wed, 17 Oct 2018, Sven Schreiber wrote:
Am 12.10.2018 um 09:06 schrieb Riccardo (Jack) Lucchetti:
> On Fri, 12 Oct 2018, Sven Schreiber wrote:
>
>
> In some cases, you may want to apply the elimination operation to matrices
> that have more than one column. I'd modify your function as
...
> The same goes for the duplication operation, I guess.
OK, I've only found the straightforward loop approach for this:
<hansl>
function matrix duplicate(const matrix vechA)
matrix out = {}
loop i=1..cols(vechA) -q
out ~= vec(unvech(vechA[,i]))
endloop
return out
end function
</hansl>
If you have some more efficient indexing trick, let me know.
How about this?
<hansl>
function matrix duplicate(const matrix vechA)
e = vec(unvech(seq(1,rows(vechA))'))
return vechA[e,]
end function
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------